Class PayloadIntDecodingIterator

  • All Implemented Interfaces:
    CategoryListIterator

    public class PayloadIntDecodingIterator
    extends Object
    implements CategoryListIterator
    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) {
       }
     }
     
    WARNING: This API is experimental and might change in incompatible ways in the next release.