Package org.apache.lucene.facet.search
Class PayloadIterator
- java.lang.Object
-
- org.apache.lucene.facet.search.PayloadIterator
-
- Direct Known Subclasses:
EnhancementsPayloadIterator
public class PayloadIterator extends Object
A utility class for iterating through a posting list of a given term and retrieving the payload of the first occurrence in every document. Comes with its own working space (buffer).- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
buffer
protected int
payloadLength
-
Constructor Summary
Constructors Constructor Description PayloadIterator(IndexReader indexReader, Term term)
PayloadIterator(IndexReader indexReader, Term term, byte[] buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBuffer()
Get the buffer with the content of the last read payload.int
getPayloadLength()
Get the length of the last read payload.boolean
init()
(re)initialize the iterator.boolean
setdoc(int docId)
Skip forward to document docId.
-
-
-
Constructor Detail
-
PayloadIterator
public PayloadIterator(IndexReader indexReader, Term term) throws IOException
- Throws:
IOException
-
PayloadIterator
public PayloadIterator(IndexReader indexReader, Term term, byte[] buffer) throws IOException
- Throws:
IOException
-
-
Method Detail
-
init
public boolean init() throws IOException
(re)initialize the iterator. Should be done before the first call tosetdoc(int)
. Returns false if there is no category list found (no setdoc() will never return true).- Throws:
IOException
-
setdoc
public boolean setdoc(int docId) throws IOException
Skip forward to document docId. Return true if this document exists and has any payload.Users should call this method with increasing docIds, and implementations can assume that this is the case.
- Throws:
IOException
-
getBuffer
public byte[] getBuffer()
Get the buffer with the content of the last read payload.
-
getPayloadLength
public int getPayloadLength()
Get the length of the last read payload.
-
-