|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.facet.search.PayloadIntDecodingIterator
public class PayloadIntDecodingIterator
A payload deserializer comes with its own working space (buffer). One need to
define the IndexReader
and Term
in which the payload resides.
The iterator then consumes the payload information of each document and
decodes it into categories. A typical use case of this class is:
IndexReader reader = [open your reader]; Term t = new Term("field", "where-payload-exists"); CategoryListIterator cli = new PayloadIntDecodingIterator(reader, t); if (!cli.init()) { // it means there are no payloads / documents associated with that term. // Usually a sanity check. However, init() must be called. } DocIdSetIterator disi = [you usually iterate on something else, such as a Scorer]; int doc; while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { cli.setdoc(doc); long category; while ((category = cli.nextCategory()) < Integer.MAX_VALUE) { } }
Constructor Summary | |
---|---|
PayloadIntDecodingIterator(IndexReader indexReader,
Term term,
IntDecoder decoder)
|
|
PayloadIntDecodingIterator(IndexReader indexReader,
Term term,
IntDecoder decoder,
byte[] buffer)
|
Method Summary | |
---|---|
boolean |
equals(Object other)
|
int |
hashCode()
|
boolean |
init()
Initializes the iterator. |
long |
nextCategory()
Returns the next category for the current document that is set through CategoryListIterator.skipTo(int) , or a number higher than Integer.MAX_VALUE . |
boolean |
skipTo(int docId)
Skips forward to document docId. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PayloadIntDecodingIterator(IndexReader indexReader, Term term, IntDecoder decoder) throws IOException
IOException
public PayloadIntDecodingIterator(IndexReader indexReader, Term term, IntDecoder decoder, byte[] buffer) throws IOException
IOException
Method Detail |
---|
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
public boolean init() throws IOException
CategoryListIterator
CategoryListIterator.skipTo(int)
, and its return value indicates whether there are
any relevant documents for this iterator. If it returns false, any call
to CategoryListIterator.skipTo(int)
will return false as well.
init
in interface CategoryListIterator
IOException
public long nextCategory() throws IOException
CategoryListIterator
CategoryListIterator.skipTo(int)
, or a number higher than Integer.MAX_VALUE
.
No assumptions can be made on the order of the categories.
nextCategory
in interface CategoryListIterator
IOException
public boolean skipTo(int docId) throws IOException
CategoryListIterator
CategoryListIterator.nextCategory()
for a particular document.
skipTo
in interface CategoryListIterator
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |