ParallelLeafReader
An LeafReader which reads multiple, parallel indexes. Each index added must have the same number of documents, but typically each contains different fields. Deletions are taken from the first reader. Each document contains the union of the fields of all documents with the same document number. When searching, matches for a query term are from the first index added that has the field.
This is useful, e.g., with collections that have large fields which change rarely and small fields that change more frequently. The smaller fields may be re-indexed in a new index and both indexes may be searched together.
Warning: It is up to you to make sure all indexes are created and modified the same way. For example, if you add documents to one index, you need to add the same documents in the same order to the other indexes. Failure to do so will result in undefined behavior.
Constructors
Create a ParallelLeafReader based on the provided readers; auto-closes the given readers on .close.
Create a ParallelLeafReader based on the provided readers.
Properties
Expert: Returns the root IndexReaderContext for this IndexReader's sub-reader tree.
Optional method: Return a IndexReader.CacheHelper that can be used to cache based on the content of this leaf regardless of deletions. Two readers that have the same data but different sets of deleted documents or doc values updates may be considered equal. Consider using .getReaderCacheHelper if you need deletions or dv updates to be taken into account.
Get the FieldInfos describing all fields in this reader.
Return metadata about this leaf.
Optional method: Return a CacheHelper that can be used to cache based on the content of this reader. Two readers that have different data or different sets of deleted documents will be considered different.
Functions
Checks consistency of this reader.
Throws AlreadyClosedException if this IndexReader or any of its child readers is closed, otherwise returns.
Returns BinaryDocValues for this field, or null if no binary doc values were indexed for this field. The returned instance should only be used by a single thread.
Returns ByteVectorValues for this field, or null if no ByteVectorValues were indexed. The returned instance should only be used by a single thread.
Returns the number of documents that have at least one term for this field. Note that, just like other term measures, this measure does not take deleted documents into account.
Returns a DocValuesSkipper allowing skipping ranges of doc IDs that are not of interest, or null if a skip index was not indexed. The returned instance should be confined to the thread that created it.
Returns FloatVectorValues for this field, or null if no FloatVectorValues were indexed. The returned instance should only be used by a single thread.
Returns NumericDocValues representing norms for this field, or null if no [ ] were indexed. The returned instance should only be used by a single thread.
Returns NumericDocValues for this field, or null if no numeric doc values were indexed for this field. The returned instance should only be used by a single thread.
Returns the LeafReaders that were passed on init.
Returns the PointValues used for numeric or spatial searches for the given field, or null if there are no point fields.
Expert: returns the current refCount for this reader
Returns SortedDocValues for this field, or null if no SortedDocValues were indexed for this field. The returned instance should only be used by a single thread.
Returns SortedNumericDocValues for this field, or null if no [ ] were indexed for this field. The returned instance should only be used by a single thread.
Returns SortedSetDocValues for this field, or null if no SortedSetDocValues were indexed for this field. The returned instance should only be used by a single thread.
Returns the sum of TermsEnum.docFreq for all terms in this field. Note that, just like other term measures, this measure does not take deleted documents into account.
Returns the sum of TermsEnum.totalTermFreq for all terms in this field. Note that, just like other term measures, this measure does not take deleted documents into account.
Returns true if any documents have been deleted. Implementers should consider overriding this method if .maxDoc or .numDocs are not constant-time operations.
Expert: increments the refCount of this IndexReader instance. RefCounts are used to determine when a reader can be closed safely, i.e. as soon as there are no more references. Be sure to always call a corresponding .decRef, in a finally clause; otherwise the reader may never be closed. Note that .close simply calls decRef(), which means that the IndexReader will not really be closed until .decRef has been called for all outstanding references.
Returns the reader's leaves, or itself if this reader is atomic. This is a convenience method calling this.getContext().leaves().
Returns the number of deleted documents.
Returns PostingsEnum for the specified term with PostingsEnum.FREQS.
Returns PostingsEnum for the specified term. This will return null if either the field or term does not exist.
Expert: This method is called by IndexReaders which wrap other readers (e.g. [ ] or FilterLeafReader) to register the parent at the child (this reader) on construction of the parent. When this reader is closed, it will mark all registered parents as closed, too. The references to parent readers are weak only, so they can be GCed once they are no longer in use.
Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector, by the field's similarity function. The score of each document is derived from the vector similarity in a way that ensures scores are positive and that a larger score corresponds to a higher ranking.
Returns a StoredFields reader for the stored fields of this index.
Returns a TermVectors reader for the term vectors of this index.
Returns the number of documents containing the term t. This method returns 0 if the term or field does not exists. This method does not take into account deleted documents that have not yet been merged away.
Expert: increments the refCount of this IndexReader instance only if the IndexReader has not been closed yet and returns true iff the refCount was successfully incremented, otherwise false. If this method returns false the reader is either already closed or is currently being closed. Either way this reader instance shouldn't be used by an application unless true is returned.