org.apache.lucene.facet.search
Class PayloadIterator

java.lang.Object
  extended by org.apache.lucene.facet.search.PayloadIterator

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 position in every document. For efficiency, this class does not check if documents passed to getPayload(int) are deleted, since it is usually used to iterate on payloads of documents that matched a query. If you need to skip over deleted documents, you should do so before calling getPayload(int).

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
PayloadIterator(Term term)
           
 
Method Summary
 BytesRef getPayload(int docID)
          Returns the payload of the given document, or null if the document does not exist, there are no more documents in the posting list, or the document exists but has not payload.
 boolean setNextReader(AtomicReaderContext context)
          Sets the AtomicReaderContext for which getPayload(int) calls will be made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PayloadIterator

public PayloadIterator(Term term)
                throws IOException
Throws:
IOException
Method Detail

setNextReader

public boolean setNextReader(AtomicReaderContext context)
                      throws IOException
Sets the AtomicReaderContext for which getPayload(int) calls will be made. Returns true iff this reader has payload for any of the documents belonging to the Term given to the constructor.

Throws:
IOException

getPayload

public BytesRef getPayload(int docID)
                    throws IOException
Returns the payload of the given document, or null if the document does not exist, there are no more documents in the posting list, or the document exists but has not payload. The given document IDs are treated as local to the reader given to setNextReader(AtomicReaderContext).

Throws:
IOException


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.