Package org.apache.lucene.tests.index
Class PerThreadPKLookup
- java.lang.Object
-
- org.apache.lucene.tests.index.PerThreadPKLookup
-
public class PerThreadPKLookup extends Object
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.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
docBases
protected boolean
hasDeletions
protected Bits[]
liveDocs
protected int
numSegs
protected PostingsEnum[]
postingsEnums
protected TermsEnum[]
termsEnums
-
Constructor Summary
Constructors Constructor Description PerThreadPKLookup(IndexReader r, String idFieldName)
-
-
-
Field Detail
-
termsEnums
protected final TermsEnum[] termsEnums
-
postingsEnums
protected final PostingsEnum[] postingsEnums
-
liveDocs
protected final Bits[] liveDocs
-
docBases
protected final int[] docBases
-
numSegs
protected final int numSegs
-
hasDeletions
protected final boolean hasDeletions
-
-
Constructor Detail
-
PerThreadPKLookup
public PerThreadPKLookup(IndexReader r, String idFieldName) throws IOException
- Throws:
IOException
-
-
Method Detail
-
lookup
public int lookup(BytesRef id) throws IOException
Returns docID if found, else -1.- Throws:
IOException
-
-