Class SimpleTextFieldsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.FieldsConsumer
-
- org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
class SimpleTextFieldsWriter extends FieldsConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private CompetitiveImpactAccumulator
competitiveImpactAccumulator
(package private) static BytesRef
DOC
private int
docCount
for write skip data.(package private) static BytesRef
END
(package private) static BytesRef
END_OFFSET
(package private) static BytesRef
FIELD
(package private) static BytesRef
FREQ
private long
lastDocFilePointer
private IndexOutput
out
(package private) static BytesRef
PAYLOAD
(package private) static BytesRef
POS
private BytesRefBuilder
scratch
(package private) java.lang.String
segment
private SimpleTextSkipWriter
skipWriter
(package private) static BytesRef
START_OFFSET
(package private) static BytesRef
TERM
private SegmentWriteState
writeState
-
Constructor Summary
Constructors Constructor Description SimpleTextFieldsWriter(SegmentWriteState writeState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
private long
getNorm(int doc, NumericDocValues norms)
private void
newline()
private void
write(java.lang.String s)
void
write(FieldInfos fieldInfos, Fields fields, NormsProducer normsProducer)
void
write(Fields fields, NormsProducer norms)
Write all fields, terms and postings.private void
write(BytesRef b)
-
Methods inherited from class org.apache.lucene.codecs.FieldsConsumer
merge
-
-
-
-
Field Detail
-
out
private IndexOutput out
-
scratch
private final BytesRefBuilder scratch
-
writeState
private final SegmentWriteState writeState
-
segment
final java.lang.String segment
-
docCount
private int docCount
for write skip data.
-
skipWriter
private final SimpleTextSkipWriter skipWriter
-
competitiveImpactAccumulator
private final CompetitiveImpactAccumulator competitiveImpactAccumulator
-
lastDocFilePointer
private long lastDocFilePointer
-
END
static final BytesRef END
-
FIELD
static final BytesRef FIELD
-
TERM
static final BytesRef TERM
-
DOC
static final BytesRef DOC
-
FREQ
static final BytesRef FREQ
-
POS
static final BytesRef POS
-
START_OFFSET
static final BytesRef START_OFFSET
-
END_OFFSET
static final BytesRef END_OFFSET
-
PAYLOAD
static final BytesRef PAYLOAD
-
-
Constructor Detail
-
SimpleTextFieldsWriter
public SimpleTextFieldsWriter(SegmentWriteState writeState) 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
-
write
public void write(FieldInfos fieldInfos, Fields fields, NormsProducer normsProducer) throws java.io.IOException
- Throws:
java.io.IOException
-
write
private void write(java.lang.String s) throws java.io.IOException
- Throws:
java.io.IOException
-
write
private void write(BytesRef b) throws java.io.IOException
- Throws:
java.io.IOException
-
newline
private void newline() 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
-
getNorm
private long getNorm(int doc, NumericDocValues norms) throws java.io.IOException
- Throws:
java.io.IOException
-
-