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 classBlockTermsWriter.FieldMetaDataprivate static classBlockTermsWriter.TermEntry(package private) classBlockTermsWriter.TermsWriter
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringCODEC_NAME(package private) FieldInfocurrentField(package private) FieldInfosfieldInfosprivate java.util.List<BlockTermsWriter.FieldMetaData>fieldsprivate intmaxDocprotected IndexOutputout(package private) PostingsWriterBasepostingsWriter(package private) static java.lang.StringTERMS_EXTENSIONExtension of terms fileprivate TermsIndexWriterBasetermsIndexWriterstatic intVERSION_CURRENTstatic intVERSION_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.TermsWriteraddField(FieldInfo field)voidclose()voidwrite(Fields fields, NormsProducer norms)Write all fields, terms and postings.private voidwriteTrailer(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: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:
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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classFieldsConsumer- Throws:
java.io.IOException
-
writeTrailer
private void writeTrailer(long dirStart) throws java.io.IOException- Throws:
java.io.IOException
-
-