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 classDefaultIndexingChain.PerFieldNOTE: not static: accesses at least docState, termsHash.
-
Field Summary
Fields Modifier and Type Field Description (package private) CounterbytesUsed(package private) DocumentsWriterPerThreaddocWriterprivate DefaultIndexingChain.PerField[]fieldHash(package private) FieldInfos.BuilderfieldInfosprivate DefaultIndexingChain.PerField[]fieldsprivate inthashMaskprivate InfoStreaminfoStreamprivate longnextFieldGen(package private) StoredFieldsConsumerstoredFieldsConsumer(package private) TermsHashtermsHashprivate inttotalFieldCount
-
Constructor Summary
Constructors Constructor Description DefaultIndexingChain(DocumentsWriterPerThread docWriter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()private voidfinishStoredFields()Calls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.Sorter.DocMapflush(SegmentWriteState state)private LeafReadergetDocValuesLeafReader()(package private) DocIdSetIteratorgetHasDocValues(java.lang.String field)Returns aDocIdSetIteratorfor the given field or null if the field doesn't have doc values.private DefaultIndexingChain.PerFieldgetOrAddField(java.lang.String name, IndexableFieldType fieldType, boolean invert)Returns a previously createdDefaultIndexingChain.PerField, absorbing the type information fromFieldType, and creates a newDefaultIndexingChain.PerFieldif this field name wasn't seen yet.private DefaultIndexingChain.PerFieldgetPerField(java.lang.String name)Returns a previously createdDefaultIndexingChain.PerField, or null if this field name wasn't seen yet.private voidindexDocValue(int docID, DefaultIndexingChain.PerField fp, DocValuesType dvType, IndexableField field)Called from processDocument to index one field's doc valueprivate voidindexPoint(int docID, DefaultIndexingChain.PerField fp, IndexableField field)Called from processDocument to index one field's pointprivate voidinitIndexOptions(FieldInfo info, IndexOptions indexOptions)private Sorter.DocMapmaybeSortSegment(SegmentWriteState state)voidprocessDocument(int docID, java.lang.Iterable<? extends IndexableField> document)private intprocessField(int docID, IndexableField field, long fieldGen, int fieldCount)private voidrehash()private voidstartStoredFields(int docID)Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.private voidvalidateIndexSortDVType(Sort indexSort, java.lang.String fieldToValidate, DocValuesType dvType)private static voidverifyUnIndexedFieldType(java.lang.String name, IndexableFieldType ft)private voidwriteDocValues(SegmentWriteState state, Sorter.DocMap sortMap)Writes all buffered doc values (called fromflush(org.apache.lucene.index.SegmentWriteState)).private voidwriteNorms(SegmentWriteState state, Sorter.DocMap sortMap)private voidwritePoints(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:
flushin 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:
abortin classDocConsumer- Throws:
java.io.IOException
-
rehash
private void rehash()
-
startStoredFields
private void startStoredFields(int docID) throws java.io.IOExceptionCalls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.- Throws:
java.io.IOException
-
finishStoredFields
private void finishStoredFields() throws java.io.IOExceptionCalls 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:
processDocumentin 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.IOExceptionCalled 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.PerFieldif 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:DocConsumerReturns aDocIdSetIteratorfor the given field or null if the field doesn't have doc values.- Specified by:
getHasDocValuesin classDocConsumer
-
-