Package org.apache.lucene.index
Class DefaultIndexingChain
- java.lang.Object
-
- org.apache.lucene.index.DocConsumer
-
- org.apache.lucene.index.DefaultIndexingChain
-
final class DefaultIndexingChain extends DocConsumer
Default general purpose indexing chain, which handles indexing all types of fields.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DefaultIndexingChain.PerField
NOTE: not static: accesses at least docState, termsHash.
-
Field Summary
Fields Modifier and Type Field Description (package private) Counter
bytesUsed
(package private) DocumentsWriterPerThread
docWriter
private DefaultIndexingChain.PerField[]
fieldHash
(package private) FieldInfos.Builder
fieldInfos
private DefaultIndexingChain.PerField[]
fields
private int
hashMask
private InfoStream
infoStream
private long
nextFieldGen
(package private) StoredFieldsConsumer
storedFieldsConsumer
(package private) TermsHash
termsHash
private int
totalFieldCount
-
Constructor Summary
Constructors Constructor Description DefaultIndexingChain(DocumentsWriterPerThread docWriter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
private void
finishStoredFields()
Calls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.Sorter.DocMap
flush(SegmentWriteState state)
private LeafReader
getDocValuesLeafReader()
(package private) DocIdSetIterator
getHasDocValues(java.lang.String field)
Returns aDocIdSetIterator
for the given field or null if the field doesn't have doc values.private DefaultIndexingChain.PerField
getOrAddField(java.lang.String name, IndexableFieldType fieldType, boolean invert)
Returns a previously createdDefaultIndexingChain.PerField
, absorbing the type information fromFieldType
, and creates a newDefaultIndexingChain.PerField
if this field name wasn't seen yet.private DefaultIndexingChain.PerField
getPerField(java.lang.String name)
Returns a previously createdDefaultIndexingChain.PerField
, or null if this field name wasn't seen yet.private void
indexDocValue(int docID, DefaultIndexingChain.PerField fp, DocValuesType dvType, IndexableField field)
Called from processDocument to index one field's doc valueprivate void
indexPoint(int docID, DefaultIndexingChain.PerField fp, IndexableField field)
Called from processDocument to index one field's pointprivate void
initIndexOptions(FieldInfo info, IndexOptions indexOptions)
private Sorter.DocMap
maybeSortSegment(SegmentWriteState state)
void
processDocument(int docID, java.lang.Iterable<? extends IndexableField> document)
private int
processField(int docID, IndexableField field, long fieldGen, int fieldCount)
private void
rehash()
private void
startStoredFields(int docID)
Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.private void
validateIndexSortDVType(Sort indexSort, java.lang.String fieldToValidate, DocValuesType dvType)
private static void
verifyUnIndexedFieldType(java.lang.String name, IndexableFieldType ft)
private void
writeDocValues(SegmentWriteState state, Sorter.DocMap sortMap)
Writes all buffered doc values (called fromflush(org.apache.lucene.index.SegmentWriteState)
).private void
writeNorms(SegmentWriteState state, Sorter.DocMap sortMap)
private void
writePoints(SegmentWriteState state, Sorter.DocMap sortMap)
Writes all buffered points.
-
-
-
Field Detail
-
bytesUsed
final Counter bytesUsed
-
docWriter
final DocumentsWriterPerThread docWriter
-
fieldInfos
final FieldInfos.Builder fieldInfos
-
termsHash
final TermsHash termsHash
-
storedFieldsConsumer
final StoredFieldsConsumer storedFieldsConsumer
-
fieldHash
private DefaultIndexingChain.PerField[] fieldHash
-
hashMask
private int hashMask
-
totalFieldCount
private int totalFieldCount
-
nextFieldGen
private long nextFieldGen
-
fields
private DefaultIndexingChain.PerField[] fields
-
infoStream
private final InfoStream infoStream
-
-
Constructor Detail
-
DefaultIndexingChain
public DefaultIndexingChain(DocumentsWriterPerThread docWriter)
-
-
Method Detail
-
getDocValuesLeafReader
private LeafReader getDocValuesLeafReader()
-
maybeSortSegment
private Sorter.DocMap maybeSortSegment(SegmentWriteState state) throws java.io.IOException
- Throws:
java.io.IOException
-
flush
public Sorter.DocMap flush(SegmentWriteState state) throws java.io.IOException
- Specified by:
flush
in classDocConsumer
- Throws:
java.io.IOException
-
writePoints
private void writePoints(SegmentWriteState state, Sorter.DocMap sortMap) throws java.io.IOException
Writes all buffered points.- Throws:
java.io.IOException
-
writeDocValues
private void writeDocValues(SegmentWriteState state, Sorter.DocMap sortMap) throws java.io.IOException
Writes all buffered doc values (called fromflush(org.apache.lucene.index.SegmentWriteState)
).- Throws:
java.io.IOException
-
writeNorms
private void writeNorms(SegmentWriteState state, Sorter.DocMap sortMap) throws java.io.IOException
- Throws:
java.io.IOException
-
abort
public void abort() throws java.io.IOException
- Specified by:
abort
in classDocConsumer
- Throws:
java.io.IOException
-
rehash
private void rehash()
-
startStoredFields
private void startStoredFields(int docID) throws java.io.IOException
Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.- Throws:
java.io.IOException
-
finishStoredFields
private void finishStoredFields() throws java.io.IOException
Calls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.- Throws:
java.io.IOException
-
processDocument
public void processDocument(int docID, java.lang.Iterable<? extends IndexableField> document) throws java.io.IOException
- Specified by:
processDocument
in classDocConsumer
- Throws:
java.io.IOException
-
processField
private int processField(int docID, IndexableField field, long fieldGen, int fieldCount) throws java.io.IOException
- Throws:
java.io.IOException
-
verifyUnIndexedFieldType
private static void verifyUnIndexedFieldType(java.lang.String name, IndexableFieldType ft)
-
indexPoint
private void indexPoint(int docID, DefaultIndexingChain.PerField fp, IndexableField field)
Called from processDocument to index one field's point
-
validateIndexSortDVType
private void validateIndexSortDVType(Sort indexSort, java.lang.String fieldToValidate, DocValuesType dvType) throws java.io.IOException
- Throws:
java.io.IOException
-
indexDocValue
private void indexDocValue(int docID, DefaultIndexingChain.PerField fp, DocValuesType dvType, IndexableField field) throws java.io.IOException
Called from processDocument to index one field's doc value- Throws:
java.io.IOException
-
getPerField
private DefaultIndexingChain.PerField getPerField(java.lang.String name)
Returns a previously createdDefaultIndexingChain.PerField
, or null if this field name wasn't seen yet.
-
getOrAddField
private DefaultIndexingChain.PerField getOrAddField(java.lang.String name, IndexableFieldType fieldType, boolean invert)
Returns a previously createdDefaultIndexingChain.PerField
, absorbing the type information fromFieldType
, and creates a newDefaultIndexingChain.PerField
if this field name wasn't seen yet.
-
initIndexOptions
private void initIndexOptions(FieldInfo info, IndexOptions indexOptions)
-
getHasDocValues
DocIdSetIterator getHasDocValues(java.lang.String field)
Description copied from class:DocConsumer
Returns aDocIdSetIterator
for the given field or null if the field doesn't have doc values.- Specified by:
getHasDocValues
in classDocConsumer
-
-