Package org.terrier.structures.postings

Provides classes representing single postings and atreams of postings in a posting list (e.g. an inverted index or a direct index).

A single posting (e.g. occurrences of a term in document) is represented by a Posting object.

Posting p;
System.out.println("Docid "+ p.getId() + " has " + p.getFrequency() + " occurrences");

A stream of postings (e.g. terms in a document or occurrences of a term) are represented by an IterablePosting stream.

IterablePosting ip = //obtain from InvertedIndex;
while(ip.next() != IterablePosting.EOL)
{
  System.err.println("Docid "+ ip.getId() + " has " + ip.getFrequency() + " occurrences");
}

More complex posting implementations are supported by other Posting child interfaces:

  • Posting - basic posting: id, frequency and document length only.
  • BlockPosting - positions of occurrences are available.
  • FieldPosting - the frequencies in each field, as well as field lengths are available.
In all cases during retrieval, IterablePosting implementations which also implement Posting, BlockPosting and/or FieldPosting are used, depending on how indexing has been performed. To see how to configure indexing, see Configure Indexing.