PerThreadPKLookup

class PerThreadPKLookup(reader: IndexReader, idFieldName: String, prevEnumIndexes: Map<IndexReader.CacheKey, Int> = emptyMap(), reusableTermsEnums: Array<TermsEnum?> = emptyArray(), reusablePostingsEnums: Array<PostingsEnum?> = emptyArray())

Utility class to do efficient primary-key (only 1 doc contains the given term) lookups by segment, re-using the enums. This class is not thread safe, so it is the caller's job to create and use one instance of this per thread. Do not use this if a term may appear in more than one document! It will only return the first one it finds.

Constructors

Link copied to clipboard
constructor(reader: IndexReader, idFieldName: String, prevEnumIndexes: Map<IndexReader.CacheKey, Int> = emptyMap(), reusableTermsEnums: Array<TermsEnum?> = emptyArray(), reusablePostingsEnums: Array<PostingsEnum?> = emptyArray())

Functions

Link copied to clipboard
fun lookup(id: BytesRef): Int

Returns docID if found, else -1.

Link copied to clipboard

Reuse previous PerThreadPKLookup's termsEnum and postingsEnum.