Package org.apache.lucene.index
Class IndexingChain
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 class
A schema of the field in the current document.private static class
private final class
NOTE: not static: accesses at least docState, termsHash. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBlockPool.Allocator
(package private) final Counter
private IndexingChain.PerField[]
(package private) final ByteBlockPool
private IndexingChain.PerField[]
(package private) final FieldInfos.Builder
private IndexingChain.PerField[]
private boolean
private int
private final int
private final LiveIndexWriterConfig
private final InfoStream
private long
(package private) final StoredFieldsConsumer
(package private) final TermsHash
(package private) final TermVectorsConsumer
private int
(package private) final VectorValuesConsumer
Fields 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) void
abort()
private void
Calls StoredFieldsWriter.finishDocument, aborting the segment if it hits any exception.(package private) Sorter.DocMap
flush
(SegmentWriteState state) Returns nested resources of this class.private LeafReader
(package private) DocIdSetIterator
getHasDocValues
(String field) private IndexingChain.PerField
getOrAddPerField
(String fieldName) Returns a previously createdIndexingChain.PerField
, absorbing the type information fromFieldType
, and creates a newIndexingChain.PerField
if this field name wasn't seen yet.private IndexingChain.PerField
getPerField
(String name) Returns a previously createdIndexingChain.PerField
, or null if this field name wasn't seen yet.private void
indexDocValue
(int docID, IndexingChain.PerField fp, DocValuesType dvType, IndexableField field) Called from processDocument to index one field's doc valueprivate void
private Sorter.DocMap
private void
private void
(package private) void
processDocument
(int docID, Iterable<? extends IndexableField> document) private boolean
processField
(int docID, IndexableField field, IndexingChain.PerField pf) Index each field Returnstrue
, if we are indexing a unique field with postingslong
Return the memory usage of this object in bytes.private void
rehash()
private void
startStoredFields
(int docID) Calls StoredFieldsWriter.startDocument, aborting the segment if it hits any exception.private static void
updateDocFieldSchema
(String fieldName, IndexingChain.FieldSchema schema, IndexableFieldType fieldType) private void
validateIndexSortDVType
(Sort indexSort, String fieldToValidate, DocValuesType dvType) private static void
verifyUnIndexedFieldType
(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 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.PerField
if this field name wasn't seen yet. -
updateDocFieldSchema
private static void updateDocFieldSchema(String fieldName, IndexingChain.FieldSchema schema, IndexableFieldType fieldType) -
verifyUnIndexedFieldType
-
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 -
getPerField
Returns a previously createdIndexingChain.PerField
, or null if this field name wasn't seen yet. -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
getChildResources
Description copied from interface:Accountable
Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- Specified by:
getChildResources
in interfaceAccountable
- See Also:
-
getHasDocValues
-