Package org.apache.lucene.facet.search
Interface CategoryListIterator
-
- All Known Implementing Classes:
MultiCategoryListIterator
,PayloadIntDecodingIterator
public interface CategoryListIterator
An interface for iterating over a "category list", i.e., the list of categories per document.NOTE:
- This class operates as a key to a Map. Appropriate implementation of
hashCode()
andequals()
must be provided. init()
must be called before you consume any categories, or callskipTo(int)
.skipTo(int)
must be called before any calls tonextCategory()
.nextCategory()
returns values <Integer.MAX_VALUE
, so you can use it as a stop condition.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
init()
Initializes the iterator.long
nextCategory()
Returns the next category for the current document that is set throughskipTo(int)
, or a number higher thanInteger.MAX_VALUE
.boolean
skipTo(int docId)
Skips forward to document docId.
-
-
-
Method Detail
-
init
boolean init() throws IOException
Initializes the iterator. This method must be called before any calls toskipTo(int)
, and its return value indicates whether there are any relevant documents for this iterator. If it returns false, any call toskipTo(int)
will return false as well.
NOTE: calling this method twice may result in skipping over documents for some implementations. Also, calling it again after all documents were consumed may yield unexpected behavior.- Throws:
IOException
-
skipTo
boolean skipTo(int docId) throws IOException
Skips forward to document docId. Returns true iff this document exists and has any categories. This method must be called before callingnextCategory()
for a particular document.
NOTE: Users should call this method with increasing docIds, and implementations can assume that this is the case.- Throws:
IOException
-
nextCategory
long nextCategory() throws IOException
Returns the next category for the current document that is set throughskipTo(int)
, or a number higher thanInteger.MAX_VALUE
. No assumptions can be made on the order of the categories.- Throws:
IOException
-
-