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
public abstract class DocsAndPositionsEnum extends DocsEnum
Also iterates through positions.
-
-
Field Summary
Fields Modifier and Type Field Description static int
FLAG_OFFSETS
Flag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)
if you require offsets in the returned enum.static int
FLAG_PAYLOADS
Flag 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_NONE
-
Fields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DocsAndPositionsEnum()
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract int
endOffset()
Returns end offset for the current position, or -1 if offsets were not indexed.abstract BytesRef
getPayload()
Returns the payload at this position, or null if no payload was indexed.abstract int
nextPosition()
Returns the next position.abstract int
startOffset()
Returns start offset for the current position, or -1 if offsets were not indexed.-
Methods inherited from class org.apache.lucene.index.DocsEnum
attributes, freq
-
Methods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, cost, docID, empty, nextDoc, slowAdvance
-
-
-
-
Field Detail
-
FLAG_OFFSETS
public static final int FLAG_OFFSETS
Flag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)
if you require offsets in the returned enum.- See Also:
- Constant Field Values
-
FLAG_PAYLOADS
public static final int FLAG_PAYLOADS
Flag to pass toTermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)
if you require payloads in the returned enum.- See Also:
- Constant Field Values
-
-
Method Detail
-
nextPosition
public abstract int nextPosition() throws IOException
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
public abstract int startOffset() throws IOException
Returns start offset for the current position, or -1 if offsets were not indexed.- Throws:
IOException
-
endOffset
public abstract int endOffset() throws IOException
Returns end offset for the current position, or -1 if offsets were not indexed.- Throws:
IOException
-
getPayload
public abstract BytesRef getPayload() throws IOException
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
-
-