ExitableDirectoryReader

The ExitableDirectoryReader wraps a real index DirectoryReader and allows for a QueryTimeout implementation object to be checked periodically to see if the thread should exit or not. If QueryTimeout.shouldExit returns true, an ExitingReaderException is thrown.

Constructors

Link copied to clipboard
constructor(in: DirectoryReader, queryTimeout: QueryTimeout)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Wrapper class for another FilterAtomicReader. This is used by ExitableSubReaderWrapper.

Link copied to clipboard

Wrapper class for a SubReaderWrapper that is used by the ExitableDirectoryReader.

Link copied to clipboard
open class ExitableTerms(terms: Terms, queryTimeout: QueryTimeout) : FilterLeafReader.FilterTerms

Wrapper class for another Terms implementation that is used by ExitableFields.

Link copied to clipboard

Wrapper class for TermsEnum that is used by ExitableTerms for implementing an exitable enumeration of terms.

Link copied to clipboard

Exception that is thrown to prematurely terminate a term enumeration.

Properties

Link copied to clipboard
open override val context: CompositeReaderContext

Expert: Returns the root IndexReaderContext for this IndexReader's sub-reader tree.

Link copied to clipboard
open override val indexCommit: IndexCommit
Link copied to clipboard
open override val isCurrent: Boolean
Link copied to clipboard

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.

Link copied to clipboard

Expert: returns the sequential sub readers that this reader is logically composed of. This method may not return null.

Link copied to clipboard
open override val version: Long

Version number when this IndexReader was opened.

Functions

Link copied to clipboard
open override fun close()

Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called.

Link copied to clipboard
fun decRef()

Expert: decreases the refCount of this IndexReader instance. If the refCount drops to 0, then this reader is closed. If an exception is hit, the refCount is unchanged.

Link copied to clipboard

Returns the directory this index resides in.

Link copied to clipboard
open override fun docFreq(term: Term): Int

Returns the number of documents containing the term. 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.

Link copied to clipboard
open override fun doOpenIfChanged(): DirectoryReader?

Implement this method to support .openIfChanged. If this reader does not support reopen, return null, so client code is happy. This should be consistent with .isCurrent (should always return true) if reopen is not supported.

open override fun doOpenIfChanged(commit: IndexCommit?): DirectoryReader?

Implement this method to support .openIfChanged. If this reader does not support reopen from a specific IndexCommit, throw [ ].

open override fun doOpenIfChanged(writer: IndexWriter, applyAllDeletes: Boolean): DirectoryReader?

Implement this method to support .openIfChanged. If this reader does not support reopen from IndexWriter, throw [ ].

Link copied to clipboard

Throws AlreadyClosedException if this IndexReader or any of its child readers is closed, otherwise returns.

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean

{@inheritDoc}

Link copied to clipboard

Returns the wrapped DirectoryReader.

Link copied to clipboard
open override fun getDocCount(field: String): Int

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.

Link copied to clipboard

Expert: returns the current refCount for this reader

Link copied to clipboard
open override fun getSumDocFreq(field: String): Long

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.

Link copied to clipboard
open override fun getSumTotalTermFreq(field: String): Long

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.

Link copied to clipboard

Returns true if any documents have been deleted. Implementers should consider overriding this method if .maxDoc or .numDocs are not constant-time operations.

Link copied to clipboard
open override fun hashCode(): Int

{@inheritDoc}

Link copied to clipboard
fun incRef()

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.

Link copied to clipboard

Returns the reader's leaves, or itself if this reader is atomic. This is a convenience method calling this.getContext().leaves().

Link copied to clipboard
open override fun maxDoc(): Int

Returns one greater than the largest possible document number. This may be used to, e.g., determine how big to allocate an array which will have an element for every document number in an index.

Link copied to clipboard

Returns the number of deleted documents.

Link copied to clipboard
open override fun numDocs(): Int

Returns the number of documents in this index.

Link copied to clipboard

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.

Link copied to clipboard
open override fun storedFields(): StoredFields

Returns a StoredFields reader for the stored fields of this index.

Link copied to clipboard
open override fun termVectors(): TermVectors

Returns a TermVectors reader for the term vectors of this index.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun totalTermFreq(term: Term): Long

Returns the total number of occurrences of term across all documents (the sum of the freq() for each doc that has this term). Note that, like other term measures, this measure does not take deleted documents into account.

Link copied to clipboard

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.