public final class VersionBlockTreeTermsWriter extends FieldsConsumer
BlockTreeTermsWriter
, 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.Modifier and Type | Class and Description |
---|---|
private static class |
VersionBlockTreeTermsWriter.FieldMetaData |
private static class |
VersionBlockTreeTermsWriter.PendingBlock |
private static class |
VersionBlockTreeTermsWriter.PendingEntry |
private static class |
VersionBlockTreeTermsWriter.PendingTerm |
(package private) class |
VersionBlockTreeTermsWriter.TermsWriter |
Modifier and Type | Field and Description |
---|---|
private boolean |
closed |
static int |
DEFAULT_MAX_BLOCK_SIZE
Suggested default value for the
maxItemsInBlock parameter to VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int) . |
static int |
DEFAULT_MIN_BLOCK_SIZE
Suggested default value for the
minItemsInBlock parameter to VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int) . |
(package private) FieldInfos |
fieldInfos |
private java.util.List<VersionBlockTreeTermsWriter.FieldMetaData> |
fields |
(package private) static PairOutputs<BytesRef,java.lang.Long> |
FST_OUTPUTS |
private IndexOutput |
indexOut |
(package private) int |
maxDoc |
(package private) int |
maxItemsInBlock |
(package private) int |
minItemsInBlock |
(package private) static PairOutputs.Pair<BytesRef,java.lang.Long> |
NO_OUTPUT |
private IndexOutput |
out |
(package private) static int |
OUTPUT_FLAG_HAS_TERMS |
(package private) static int |
OUTPUT_FLAG_IS_FLOOR |
(package private) static int |
OUTPUT_FLAGS_MASK |
(package private) static int |
OUTPUT_FLAGS_NUM_BITS |
(package private) PostingsWriterBase |
postingsWriter |
private RAMOutputStream |
scratchBytes |
private IntsRefBuilder |
scratchIntsRef |
private java.lang.String |
segment |
(package private) static java.lang.String |
TERMS_CODEC_NAME |
(package private) static java.lang.String |
TERMS_EXTENSION
Extension of terms file
|
(package private) static java.lang.String |
TERMS_INDEX_CODEC_NAME |
(package private) static java.lang.String |
TERMS_INDEX_EXTENSION
Extension of terms index file
|
static int |
VERSION_CURRENT
Current terms format.
|
static int |
VERSION_START
Initial terms format.
|
Constructor and Description |
---|
VersionBlockTreeTermsWriter(SegmentWriteState state,
PostingsWriterBase postingsWriter,
int minItemsInBlock,
int maxItemsInBlock)
Create a new writer.
|
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
brToString(byte[] b) |
(package private) static java.lang.String |
brToString(BytesRef b) |
void |
close() |
(package private) static long |
encodeOutput(long fp,
boolean hasTerms,
boolean isFloor) |
void |
write(Fields fields,
NormsProducer norms)
Write all fields, terms and postings.
|
private static void |
writeBytesRef(IndexOutput out,
BytesRef bytes) |
private void |
writeIndexTrailer(IndexOutput indexOut,
long dirStart)
Writes the index file trailer.
|
private void |
writeTrailer(IndexOutput out,
long dirStart)
Writes the terms file trailer.
|
merge
static final PairOutputs<BytesRef,java.lang.Long> FST_OUTPUTS
static final PairOutputs.Pair<BytesRef,java.lang.Long> NO_OUTPUT
public static final int DEFAULT_MIN_BLOCK_SIZE
minItemsInBlock
parameter to VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)
.public static final int DEFAULT_MAX_BLOCK_SIZE
maxItemsInBlock
parameter to VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)
.static final int OUTPUT_FLAGS_NUM_BITS
static final int OUTPUT_FLAGS_MASK
static final int OUTPUT_FLAG_IS_FLOOR
static final int OUTPUT_FLAG_HAS_TERMS
static final java.lang.String TERMS_EXTENSION
static final java.lang.String TERMS_CODEC_NAME
public static final int VERSION_START
public static final int VERSION_CURRENT
static final java.lang.String TERMS_INDEX_EXTENSION
static final java.lang.String TERMS_INDEX_CODEC_NAME
private final IndexOutput out
private final IndexOutput indexOut
final int maxDoc
final int minItemsInBlock
final int maxItemsInBlock
final PostingsWriterBase postingsWriter
final FieldInfos fieldInfos
private final java.util.List<VersionBlockTreeTermsWriter.FieldMetaData> fields
private final java.lang.String segment
private final RAMOutputStream scratchBytes
private final IntsRefBuilder scratchIntsRef
private boolean closed
public VersionBlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) throws java.io.IOException
java.io.IOException
private void writeTrailer(IndexOutput out, long dirStart) throws java.io.IOException
java.io.IOException
private void writeIndexTrailer(IndexOutput indexOut, long dirStart) throws java.io.IOException
java.io.IOException
public void write(Fields fields, NormsProducer norms) throws java.io.IOException
FieldsConsumer
Notes:
write
in class FieldsConsumer
java.io.IOException
static long encodeOutput(long fp, boolean hasTerms, boolean isFloor)
static java.lang.String brToString(BytesRef b)
static java.lang.String brToString(byte[] b)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class FieldsConsumer
java.io.IOException
private static void writeBytesRef(IndexOutput out, BytesRef bytes) throws java.io.IOException
java.io.IOException