Module org.apache.lucene.codecs
Class VariableGapTermsIndexWriter
- java.lang.Object
-
- org.apache.lucene.codecs.blockterms.TermsIndexWriterBase
-
- org.apache.lucene.codecs.blockterms.VariableGapTermsIndexWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class VariableGapTermsIndexWriter extends TermsIndexWriterBase
Selects index terms according to provided pluggableVariableGapTermsIndexWriter.IndexTermSelector
, and stores them in a prefix trie that's loaded entirely in RAM stored as an FST. This terms index only supports unsigned byte term sort order (unicode codepoint order when the bytes are UTF8).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VariableGapTermsIndexWriter.EveryNOrDocFreqTermSelector
Sets an index term when docFreq >= docFreqThresh, or every interval terms.static class
VariableGapTermsIndexWriter.EveryNTermSelector
Same policy asFixedGapTermsIndexWriter
private class
VariableGapTermsIndexWriter.FSTFieldWriter
static class
VariableGapTermsIndexWriter.IndexTermSelector
Hook for selecting which terms should be placed in the terms index.-
Nested classes/interfaces inherited from class org.apache.lucene.codecs.blockterms.TermsIndexWriterBase
TermsIndexWriterBase.FieldWriter
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
CODEC_NAME
private FieldInfos
fieldInfos
private java.util.List<VariableGapTermsIndexWriter.FSTFieldWriter>
fields
protected IndexOutput
out
private VariableGapTermsIndexWriter.IndexTermSelector
policy
(package private) static java.lang.String
TERMS_INDEX_EXTENSION
Extension of terms index file(package private) static int
VERSION_CURRENT
(package private) static int
VERSION_START
-
Constructor Summary
Constructors Constructor Description VariableGapTermsIndexWriter(SegmentWriteState state, VariableGapTermsIndexWriter.IndexTermSelector policy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TermsIndexWriterBase.FieldWriter
addField(FieldInfo field, long termsFilePointer)
void
close()
protected int
indexedTermPrefixLength(BytesRef priorTerm, BytesRef indexedTerm)
NOTE: if your codec does not sort in unicode code point order, you must override this method, to simply return indexedTerm.length.private void
writeTrailer(long dirStart)
-
-
-
Field Detail
-
out
protected IndexOutput out
-
TERMS_INDEX_EXTENSION
static final java.lang.String TERMS_INDEX_EXTENSION
Extension of terms index file- See Also:
- Constant Field Values
-
CODEC_NAME
static final java.lang.String CODEC_NAME
- See Also:
- Constant Field Values
-
VERSION_START
static final int VERSION_START
- See Also:
- Constant Field Values
-
VERSION_CURRENT
static final int VERSION_CURRENT
- See Also:
- Constant Field Values
-
fields
private final java.util.List<VariableGapTermsIndexWriter.FSTFieldWriter> fields
-
fieldInfos
private final FieldInfos fieldInfos
-
policy
private final VariableGapTermsIndexWriter.IndexTermSelector policy
-
-
Constructor Detail
-
VariableGapTermsIndexWriter
public VariableGapTermsIndexWriter(SegmentWriteState state, VariableGapTermsIndexWriter.IndexTermSelector policy) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
addField
public TermsIndexWriterBase.FieldWriter addField(FieldInfo field, long termsFilePointer) throws java.io.IOException
- Specified by:
addField
in classTermsIndexWriterBase
- Throws:
java.io.IOException
-
indexedTermPrefixLength
protected int indexedTermPrefixLength(BytesRef priorTerm, BytesRef indexedTerm)
NOTE: if your codec does not sort in unicode code point order, you must override this method, to simply return indexedTerm.length.
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
writeTrailer
private void writeTrailer(long dirStart) throws java.io.IOException
- Throws:
java.io.IOException
-
-