Package org.apache.lucene.index
Class DocsAndPositionsEnum
java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.index.DocsEnum
org.apache.lucene.index.DocsAndPositionsEnum
- Direct Known Subclasses:
FilterAtomicReader.FilterDocsAndPositionsEnum,MappingMultiDocsAndPositionsEnum,MultiDocsAndPositionsEnum
Also iterates through positions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFlag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)if you require offsets in the returned enum.static final intFlag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)if you require payloads in the returned enum.Fields inherited from class org.apache.lucene.index.DocsEnum
FLAG_FREQS, FLAG_NONEFields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intReturns end offset for the current position, or -1 if offsets were not indexed.abstract BytesRefReturns the payload at this position, or null if no payload was indexed.abstract intReturns the next position.abstract intReturns start offset for the current position, or -1 if offsets were not indexed.Methods inherited from class org.apache.lucene.index.DocsEnum
attributes, freqMethods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, cost, docID, empty, nextDoc, slowAdvance
-
Field Details
-
FLAG_OFFSETS
public static final int FLAG_OFFSETSFlag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)if you require offsets in the returned enum.- See Also:
-
FLAG_PAYLOADS
public static final int FLAG_PAYLOADSFlag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)if you require payloads in the returned enum.- See Also:
-
-
Constructor Details
-
DocsAndPositionsEnum
protected DocsAndPositionsEnum()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
nextPosition
Returns the next position. You should only call this up toDocsEnum.freq()times else the behavior is not defined. If positions were not indexed this will return -1; this only happens if offsets were indexed and you passed needsOffset=true when pulling the enum.- 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
-