Package org.apache.lucene.index
Class DefaultIndexingChain
java.lang.Object
org.apache.lucene.index.DocConsumer
org.apache.lucene.index.DefaultIndexingChain
- All Implemented Interfaces:
Accountable
Default general purpose indexing chain, which handles
indexing all types of fields.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate final classNOTE: not static: accesses at least docState, termsHash. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBlockPool.Allocator(package private) final Counterprivate DefaultIndexingChain.PerField[](package private) final FieldInfos.Builderprivate DefaultIndexingChain.PerField[]private booleanprivate intprivate final intprivate final LiveIndexWriterConfigprivate final InfoStreamprivate long(package private) final StoredFieldsConsumer(package private) final TermsHash(package private) final TermVectorsConsumerprivate intFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultIndexingChain(int indexCreatedVersionMajor, SegmentInfo segmentInfo, Directory directory, FieldInfos.Builder fieldInfos, LiveIndexWriterConfig indexWriterConfig, Consumer<Throwable> abortingExceptionConsumer) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()private voidCalls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.flush(SegmentWriteState state) Returns nested resources of this class.private LeafReader(package private) DocIdSetIteratorgetHasDocValues(String field) Returns aDocIdSetIteratorfor the given field or null if the field doesn't have doc values.private DefaultIndexingChain.PerFieldgetOrAddField(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(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.DocMapprivate voidvoidprocessDocument(int docID, Iterable<? extends IndexableField> document) private intprocessField(int docID, IndexableField field, long fieldGen, int fieldCount) longReturn the memory usage of this object in bytes.private voidrehash()private voidstartStoredFields(int docID) Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.private voidvalidateIndexSortDVType(Sort indexSort, String fieldToValidate, DocValuesType dvType) private static voidverifyUnIndexedFieldType(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 Details
-
bytesUsed
-
fieldInfos
-
termsHash
-
storedFieldsConsumer
-
termVectorsWriter
-
fieldHash
-
hashMask
private int hashMask -
totalFieldCount
private int totalFieldCount -
nextFieldGen
private long nextFieldGen -
fields
-
infoStream
-
byteBlockAllocator
-
indexWriterConfig
-
indexCreatedVersionMajor
private final int indexCreatedVersionMajor -
abortingExceptionConsumer
-
hasHitAbortingException
private boolean hasHitAbortingException
-
-
Constructor Details
-
DefaultIndexingChain
DefaultIndexingChain(int indexCreatedVersionMajor, SegmentInfo segmentInfo, Directory directory, FieldInfos.Builder fieldInfos, LiveIndexWriterConfig indexWriterConfig, Consumer<Throwable> abortingExceptionConsumer)
-
-
Method Details
-
onAbortingException
-
getDocValuesLeafReader
-
maybeSortSegment
- Throws:
IOException
-
flush
- Specified by:
flushin classDocConsumer- Throws:
IOException
-
writePoints
Writes all buffered points.- Throws:
IOException
-
writeDocValues
Writes all buffered doc values (called fromflush(org.apache.lucene.index.SegmentWriteState)).- Throws:
IOException
-
writeNorms
- Throws:
IOException
-
abort
- Specified by:
abortin classDocConsumer- Throws:
IOException
-
rehash
private void rehash() -
startStoredFields
Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.- Throws:
IOException
-
finishStoredFields
Calls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.- Throws:
IOException
-
processDocument
public void processDocument(int docID, Iterable<? extends IndexableField> document) throws IOException - Specified by:
processDocumentin classDocConsumer- Throws:
IOException
-
processField
private int processField(int docID, IndexableField field, long fieldGen, int fieldCount) throws IOException - Throws:
IOException
-
verifyUnIndexedFieldType
-
indexPoint
Called from processDocument to index one field's point -
validateIndexSortDVType
private void validateIndexSortDVType(Sort indexSort, String fieldToValidate, DocValuesType dvType) throws IOException - Throws:
IOException
-
indexDocValue
private void indexDocValue(int docID, DefaultIndexingChain.PerField fp, DocValuesType dvType, IndexableField field) throws IOException Called from processDocument to index one field's doc value- Throws:
IOException
-
getPerField
Returns a previously createdDefaultIndexingChain.PerField, or null if this field name wasn't seen yet. -
getOrAddField
private DefaultIndexingChain.PerField getOrAddField(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
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal. -
getChildResources
Description copied from interface:AccountableReturns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- See Also:
-
getHasDocValues
Description copied from class:DocConsumerReturns aDocIdSetIteratorfor the given field or null if the field doesn't have doc values.- Specified by:
getHasDocValuesin classDocConsumer
-