Package org.apache.lucene.index
Class PostingsEnum
java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.index.PostingsEnum
- Direct Known Subclasses:
FilterLeafReader.FilterPostingsEnum
,ImpactsEnum
,MultiPhraseQuery.UnionPostingsEnum
,MultiPostingsEnum
Iterates through the postings. NOTE: you must first call
DocIdSetIterator.nextDoc()
before using any of the
per-doc methods.-
Field Summary
Modifier and TypeFieldDescriptionstatic final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
to get positions, payloads and offsets in the returned enumstatic final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
if you require term frequencies in the returned enum.static final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
if you don't require per-document postings in the returned enum.static final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
if you require offsets in the returned enum.static final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
if you require payloads in the returned enum.static final short
Flag to pass toTermsEnum.postings(PostingsEnum, int)
if you require term positions in the returned enum.Fields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract int
Returns end offset for the current position, or -1 if offsets were not indexed.static boolean
featureRequested
(int flags, short feature) Returns true if the given feature is requested in the flags, false otherwise.abstract int
freq()
Returns term frequency in the current document, or 1 if the field was indexed withIndexOptions.DOCS
.abstract BytesRef
Returns the payload at this position, or null if no payload was indexed.abstract int
Returns the next position, or -1 if positions were not indexed.abstract int
Returns start offset for the current position, or -1 if offsets were not indexed.Methods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, cost, docID, empty, nextDoc, range, slowAdvance
-
Field Details
-
NONE
public static final short NONEFlag to pass toTermsEnum.postings(PostingsEnum, int)
if you don't require per-document postings in the returned enum.- See Also:
-
FREQS
public static final short FREQSFlag to pass toTermsEnum.postings(PostingsEnum, int)
if you require term frequencies in the returned enum.- See Also:
-
POSITIONS
public static final short POSITIONSFlag to pass toTermsEnum.postings(PostingsEnum, int)
if you require term positions in the returned enum.- See Also:
-
OFFSETS
public static final short OFFSETSFlag to pass toTermsEnum.postings(PostingsEnum, int)
if you require offsets in the returned enum.- See Also:
-
PAYLOADS
public static final short PAYLOADSFlag to pass toTermsEnum.postings(PostingsEnum, int)
if you require payloads in the returned enum.- See Also:
-
ALL
public static final short ALLFlag to pass toTermsEnum.postings(PostingsEnum, int)
to get positions, payloads and offsets in the returned enum- See Also:
-
-
Constructor Details
-
PostingsEnum
protected PostingsEnum()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
featureRequested
public static boolean featureRequested(int flags, short feature) Returns true if the given feature is requested in the flags, false otherwise. -
freq
Returns term frequency in the current document, or 1 if the field was indexed withIndexOptions.DOCS
. Do not call this beforeDocIdSetIterator.nextDoc()
is first called, nor afterDocIdSetIterator.nextDoc()
returnsDocIdSetIterator.NO_MORE_DOCS
.NOTE: if the
PostingsEnum
was obtain withNONE
, the result of this method is undefined.- Throws:
IOException
-
nextPosition
Returns the next position, or -1 if positions were not indexed. Calling this more thanfreq()
times is undefined.- Throws:
IOException
-
startOffset
Returns start offset for the current position, or -1 if offsets were not indexed.- Throws:
IOException
-
endOffset
Returns end offset for the current position, or -1 if offsets were not indexed.- Throws:
IOException
-
getPayload
Returns the payload at this position, or null if no payload was indexed. You should not modify anything (neither members of the returned BytesRef nor bytes in the byte[]).- Throws:
IOException
-