public class IDVersionPostingsFormat extends PostingsFormat
longToBytes(long, org.apache.lucene.util.BytesRef) during indexing. At search time,
the TermsEnum implementation IDVersionSegmentTermsEnum
enables fast (using only the terms index when possible) lookup for
whether a given ID was previously indexed with version > N (see
IDVersionSegmentTermsEnum.seekExact(BytesRef,long).
This is most effective if the app assigns monotonically
increasing global version to each indexed doc. Then, during
indexing, use IDVersionSegmentTermsEnum.seekExact(BytesRef,long) (along with
LiveFieldValues) to decide whether the document you are
about to index was already indexed with a higher version, and skip
it if so.
The field is effectively indexed as DOCS_ONLY and the docID is pulsed into the terms dictionary, but the user must feed in the version as a payload on the first token.
NOTE: term vectors cannot be indexed with this field (not that you should really ever want to do this).
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
MAX_VERSION
version must be <= this, because we encode with ZigZag.
|
static long |
MIN_VERSION
version must be >= this.
|
EMPTY| 构造器和说明 |
|---|
IDVersionPostingsFormat() |
IDVersionPostingsFormat(int minTermsInBlock,
int maxTermsInBlock) |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
bytesToLong(BytesRef bytes) |
FieldsConsumer |
fieldsConsumer(SegmentWriteState state) |
FieldsProducer |
fieldsProducer(SegmentReadState state) |
static void |
longToBytes(long v,
BytesRef bytes) |
availablePostingsFormats, forName, getName, reloadPostingsFormats, toStringpublic static final long MIN_VERSION
public static final long MAX_VERSION
public IDVersionPostingsFormat()
public IDVersionPostingsFormat(int minTermsInBlock,
int maxTermsInBlock)
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException
fieldsConsumer 在类中 PostingsFormatIOExceptionpublic FieldsProducer fieldsProducer(SegmentReadState state) throws IOException
fieldsProducer 在类中 PostingsFormatIOExceptionpublic static long bytesToLong(BytesRef bytes)
public static void longToBytes(long v,
BytesRef bytes)
Copyright © 2022. All rights reserved.