java.lang.Object
org.apache.lucene.index.IndexingChain
- All Implemented Interfaces:
Accountable
Default general purpose indexing chain, which handles indexing all types of fields.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA schema of the field in the current document.private static classprivate final classNOTE: not static: accesses at least docState, termsHash.(package private) static final classIndexingChain.ReservedField<T extends IndexableField> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBlockPool.Allocator(package private) final Counterprivate IndexingChain.PerField[](package private) final ByteBlockPoolprivate IndexingChain.PerField[](package private) final FieldInfos.Builderprivate IndexingChain.PerField[]private booleanprivate intprivate final intprivate final LiveIndexWriterConfigprivate final InfoStreamprivate long(package private) final StoredFieldsConsumer(package private) final TermsHash(package private) final TermVectorsConsumerprivate int(package private) final VectorValuesConsumerFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionIndexingChain(int indexCreatedVersionMajor, SegmentInfo segmentInfo, Directory directory, FieldInfos.Builder fieldInfos, LiveIndexWriterConfig indexWriterConfig, Consumer<Throwable> abortingExceptionConsumer) -
Method Summary
Modifier and TypeMethodDescription(package private) voidabort()private voidCalls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.(package private) Sorter.DocMapflush(SegmentWriteState state) Returns nested resources of this class.private LeafReader(package private) DocIdSetIteratorgetHasDocValues(String field) private IndexingChain.PerFieldgetOrAddPerField(String fieldName, boolean reserved) Returns a previously createdIndexingChain.PerField, absorbing the type information fromFieldType, and creates a newIndexingChain.PerFieldif this field name wasn't seen yet.private IndexingChain.PerFieldgetPerField(String name) Returns a previously createdIndexingChain.PerField, or null if this field name wasn't seen yet.private voidindexDocValue(int docID, IndexingChain.PerField fp, DocValuesType dvType, IndexableField field) Called from processDocument to index one field's doc valueprivate voidindexVectorValue(int docID, IndexingChain.PerField pf, VectorEncoding vectorEncoding, IndexableField field) private void(package private) <T extends IndexableField>
IndexingChain.ReservedField<T> markAsReserved(T field) Wraps the given field in a reserved field and registers it as reserved.private Sorter.DocMapprivate voidprivate void(package private) voidprocessDocument(int docID, Iterable<? extends IndexableField> document) private booleanprocessField(int docID, IndexableField field, IndexingChain.PerField pf) Index each field Returnstrue, if we are indexing a unique field with postingslongReturn 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 static voidupdateDocFieldSchema(String fieldName, IndexingChain.FieldSchema schema, IndexableFieldType fieldType) private voidvalidateIndexSortDVType(Sort indexSort, String fieldToValidate, DocValuesType dvType) private static voidvalidateMaxVectorDimension(String fieldName, int vectorDim, int maxVectorDim) 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
-
docValuesBytePool
-
storedFieldsConsumer
-
vectorValuesConsumer
-
termVectorsWriter
-
fieldHash
-
hashMask
private int hashMask -
totalFieldCount
private int totalFieldCount -
nextFieldGen
private long nextFieldGen -
fields
-
docFields
-
infoStream
-
byteBlockAllocator
-
indexWriterConfig
-
indexCreatedVersionMajor
private final int indexCreatedVersionMajor -
abortingExceptionConsumer
-
hasHitAbortingException
private boolean hasHitAbortingException
-
-
Constructor Details
-
IndexingChain
IndexingChain(int indexCreatedVersionMajor, SegmentInfo segmentInfo, Directory directory, FieldInfos.Builder fieldInfos, LiveIndexWriterConfig indexWriterConfig, Consumer<Throwable> abortingExceptionConsumer)
-
-
Method Details
-
onAbortingException
-
getDocValuesLeafReader
-
maybeSortSegment
- Throws:
IOException
-
flush
- 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
- 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
- Throws:
IOException
-
oversizeDocFields
private void oversizeDocFields() -
initializeFieldInfo
- Throws:
IOException
-
processField
private boolean processField(int docID, IndexableField field, IndexingChain.PerField pf) throws IOException Index each field Returnstrue, if we are indexing a unique field with postings- Throws:
IOException
-
getOrAddPerField
Returns a previously createdIndexingChain.PerField, absorbing the type information fromFieldType, and creates a newIndexingChain.PerFieldif this field name wasn't seen yet. -
updateDocFieldSchema
private static void updateDocFieldSchema(String fieldName, IndexingChain.FieldSchema schema, IndexableFieldType fieldType) -
verifyUnIndexedFieldType
-
validateMaxVectorDimension
-
validateIndexSortDVType
private void validateIndexSortDVType(Sort indexSort, String fieldToValidate, DocValuesType dvType) throws IOException - Throws:
IOException
-
indexDocValue
private void indexDocValue(int docID, IndexingChain.PerField fp, DocValuesType dvType, IndexableField field) Called from processDocument to index one field's doc value -
indexVectorValue
private void indexVectorValue(int docID, IndexingChain.PerField pf, VectorEncoding vectorEncoding, IndexableField field) throws IOException - Throws:
IOException
-
getPerField
Returns a previously createdIndexingChain.PerField, or null if this field name wasn't seen yet. -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
getChildResources
Description copied from interface:AccountableReturns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- Specified by:
getChildResourcesin interfaceAccountable- See Also:
-
getHasDocValues
-
markAsReserved
Wraps the given field in a reserved field and registers it as reserved. Only DWPT should do this to mark fields as private / reserved to prevent this fieldname to be used from the outside of the IW / DWPT eco-system
-