Module org.apache.lucene.sandbox
Class VersionBlockTreeTermsWriter
java.lang.Object
org.apache.lucene.codecs.FieldsConsumer
org.apache.lucene.sandbox.codecs.idversion.VersionBlockTreeTermsWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
This is just like
Lucene90BlockTreeTermsWriter, except it also stores a version per term,
and adds a method to its TermsEnum implementation to seekExact only if the version is >= the
specified version. The version is added to the terms index to avoid seeking if no term in the
block has a high enough version. The term blocks file is .tiv and the terms index extension is
.tipv.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static final classprivate static classprivate static final class(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanstatic final intSuggested default value for themaxItemsInBlockparameter toVersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int).static final intSuggested default value for theminItemsInBlockparameter toVersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int).(package private) final FieldInfosprivate final List<VersionBlockTreeTermsWriter.FieldMetaData> (package private) static final PairOutputs<BytesRef, Long> private final IndexOutput(package private) final int(package private) final int(package private) final int(package private) static final PairOutputs.Pair<BytesRef, Long> private final IndexOutput(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) final PostingsWriterBaseprivate final ByteBuffersDataOutputprivate final IntsRefBuilder(package private) static final String(package private) static final StringExtension of terms file(package private) static final String(package private) static final StringExtension of terms index filestatic final intCurrent terms format.static final intInitial terms format. -
Constructor Summary
ConstructorsConstructorDescriptionVersionBlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) Create a new writer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()(package private) static longencodeOutput(long fp, boolean hasTerms, boolean isFloor) voidwrite(Fields fields, NormsProducer norms) Write all fields, terms and postings.private static voidwriteBytesRef(IndexOutput out, BytesRef bytes) private voidwriteIndexTrailer(IndexOutput indexOut, long dirStart) Writes the index file trailer.private voidwriteTrailer(IndexOutput out, long dirStart) Writes the terms file trailer.Methods inherited from class org.apache.lucene.codecs.FieldsConsumer
merge
-
Field Details
-
FST_OUTPUTS
-
NO_OUTPUT
-
DEFAULT_MIN_BLOCK_SIZE
public static final int DEFAULT_MIN_BLOCK_SIZESuggested default value for theminItemsInBlockparameter toVersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int).- See Also:
-
DEFAULT_MAX_BLOCK_SIZE
public static final int DEFAULT_MAX_BLOCK_SIZESuggested default value for themaxItemsInBlockparameter toVersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int).- See Also:
-
OUTPUT_FLAGS_NUM_BITS
static final int OUTPUT_FLAGS_NUM_BITS- See Also:
-
OUTPUT_FLAGS_MASK
static final int OUTPUT_FLAGS_MASK- See Also:
-
OUTPUT_FLAG_IS_FLOOR
static final int OUTPUT_FLAG_IS_FLOOR- See Also:
-
OUTPUT_FLAG_HAS_TERMS
static final int OUTPUT_FLAG_HAS_TERMS- See Also:
-
TERMS_EXTENSION
Extension of terms file- See Also:
-
TERMS_CODEC_NAME
- See Also:
-
VERSION_START
public static final int VERSION_STARTInitial terms format.- See Also:
-
VERSION_CURRENT
public static final int VERSION_CURRENTCurrent terms format.- See Also:
-
TERMS_INDEX_EXTENSION
Extension of terms index file- See Also:
-
TERMS_INDEX_CODEC_NAME
- See Also:
-
out
-
indexOut
-
maxDoc
final int maxDoc -
minItemsInBlock
final int minItemsInBlock -
maxItemsInBlock
final int maxItemsInBlock -
postingsWriter
-
fieldInfos
-
fields
-
scratchBytes
-
scratchIntsRef
-
closed
private boolean closed
-
-
Constructor Details
-
VersionBlockTreeTermsWriter
public VersionBlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) throws IOException Create a new writer. The number of items (terms or sub-blocks) per block will aim to be between minItemsPerBlock and maxItemsPerBlock, though in some cases the blocks may be smaller than the min.- Throws:
IOException
-
-
Method Details
-
writeTrailer
Writes the terms file trailer.- Throws:
IOException
-
writeIndexTrailer
Writes the index file trailer.- Throws:
IOException
-
write
Description copied from class:FieldsConsumerWrite all fields, terms and postings. This the "pull" API, allowing you to iterate more than once over the postings, somewhat analogous to using a DOM API to traverse an XML tree.Notes:
- You must compute index statistics, including each Term's docFreq and totalTermFreq, as well as the summary sumTotalTermFreq, sumTotalDocFreq and docCount.
- You must skip terms that have no docs and fields that have no terms, even though the provided Fields API will expose them; this typically requires lazily writing the field or term until you've actually seen the first term or document.
- The provided Fields instance is limited: you cannot call any methods that return statistics/counts; you cannot pass a non-null live docs when pulling docs/positions enums.
- Specified by:
writein classFieldsConsumer- Throws:
IOException
-
encodeOutput
static long encodeOutput(long fp, boolean hasTerms, boolean isFloor) -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classFieldsConsumer- Throws:
IOException
-
writeBytesRef
- Throws:
IOException
-