Class BlockTermsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.FieldsConsumer
-
- org.apache.lucene.codecs.blockterms.BlockTermsWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class BlockTermsWriter extends FieldsConsumer implements java.io.Closeable
Writes terms dict, block-encoding (column stride) each term's metadata for each set of terms between two index terms.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
BlockTermsWriter.FieldMetaData
private static class
BlockTermsWriter.TermEntry
(package private) class
BlockTermsWriter.TermsWriter
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
CODEC_NAME
(package private) FieldInfo
currentField
(package private) FieldInfos
fieldInfos
private java.util.List<BlockTermsWriter.FieldMetaData>
fields
private int
maxDoc
protected IndexOutput
out
(package private) PostingsWriterBase
postingsWriter
(package private) static java.lang.String
TERMS_EXTENSION
Extension of terms fileprivate TermsIndexWriterBase
termsIndexWriter
static int
VERSION_CURRENT
static int
VERSION_START
-
Constructor Summary
Constructors Constructor Description BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private BlockTermsWriter.TermsWriter
addField(FieldInfo field)
void
close()
void
write(Fields fields, NormsProducer norms)
Write all fields, terms and postings.private void
writeTrailer(long dirStart)
-
Methods inherited from class org.apache.lucene.codecs.FieldsConsumer
merge
-
-
-
-
Field Detail
-
CODEC_NAME
static final java.lang.String CODEC_NAME
- See Also:
- Constant Field Values
-
VERSION_START
public static final int VERSION_START
- See Also:
- Constant Field Values
-
VERSION_CURRENT
public static final int VERSION_CURRENT
- See Also:
- Constant Field Values
-
TERMS_EXTENSION
static final java.lang.String TERMS_EXTENSION
Extension of terms file- See Also:
- Constant Field Values
-
out
protected IndexOutput out
-
postingsWriter
final PostingsWriterBase postingsWriter
-
fieldInfos
final FieldInfos fieldInfos
-
currentField
FieldInfo currentField
-
termsIndexWriter
private final TermsIndexWriterBase termsIndexWriter
-
maxDoc
private final int maxDoc
-
fields
private final java.util.List<BlockTermsWriter.FieldMetaData> fields
-
-
Constructor Detail
-
BlockTermsWriter
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
write
public void write(Fields fields, NormsProducer norms) throws java.io.IOException
Description copied from class:FieldsConsumer
Write 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:
write
in classFieldsConsumer
- Throws:
java.io.IOException
-
addField
private BlockTermsWriter.TermsWriter addField(FieldInfo field) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classFieldsConsumer
- Throws:
java.io.IOException
-
writeTrailer
private void writeTrailer(long dirStart) throws java.io.IOException
- Throws:
java.io.IOException
-
-