MultiXorPostList Class Reference

N-way XOR postlist. More...

#include <multixorpostlist.h>

Inheritance diagram for MultiXorPostList:

Inheritance graph
[legend]
Collaboration diagram for MultiXorPostList:

Collaboration graph
[legend]

List of all members.

Public Member Functions

template<class RandomItor >
 MultiXorPostList (RandomItor pl_begin, RandomItor pl_end, MultiMatch *matcher_, Xapian::doccount db_size_)
 Construct from 2 random-access iterators to a container of PostList*, a pointer to the matcher, and the document collection size.
 ~MultiXorPostList ()
Xapian::doccount get_termfreq_min () const
 Get a lower bound on the number of documents indexed by this term.
Xapian::doccount get_termfreq_max () const
 Get an upper bound on the number of documents indexed by this term.
Xapian::doccount get_termfreq_est () const
 Get an estimate of the number of documents indexed by this term.
TermFreqs get_termfreq_est_using_stats (const Xapian::Weight::Internal &stats) const
 Get an estimate for the termfreq and reltermfreq, given the stats.
Xapian::weight get_maxweight () const
 Return an upper bound on what get_weight() can return.
Xapian::docid get_docid () const
 Return the current docid.
Xapian::termcount get_doclength () const
 Return the length of current document.
Xapian::weight get_weight () const
 Return the weight contribution for the current position.
bool at_end () const
 Return true if the current position is past the last entry in this list.
Xapian::weight recalc_maxweight ()
 Recalculate the upper bound on what get_weight() can return.
Internal * next (Xapian::weight w_min)
 Advance the current position to the next document in the postlist.
Internal * skip_to (Xapian::docid, Xapian::weight w_min)
 Skip forward to the specified docid.
std::string get_description () const
 Return a string description of this object.
Xapian::termcount get_wdf () const
 get_wdf() for MultiXorPostlists returns the sum of the wdfs of the sub postlists which match the current docid.
Xapian::termcount count_matching_subqs () const
 Count the number of leaf subqueries which match at the current position.

Private Member Functions

void operator= (const MultiXorPostList &)
 Don't allow assignment.
 MultiXorPostList (const MultiXorPostList &)
 Don't allow copying.
void erase_sublist (size_t i)
 Erase a sub-postlist.

Private Attributes

Xapian::docid did
 The current docid, or zero if we haven't started or are at_end.
size_t n_kids
 The number of sub-postlists.
PostList ** plist
 Array of pointers to sub-postlists.
Xapian::weight max_total
 Total maximum weight the XOR could possibly return.
Xapian::doccount db_size
 The number of documents in the database.
MultiMatchmatcher
 Pointer to the matcher object, so we can report pruning.


Detailed Description

N-way XOR postlist.

Definition at line 34 of file multixorpostlist.h.


Constructor & Destructor Documentation

MultiXorPostList::MultiXorPostList ( const MultiXorPostList  )  [private]

Don't allow copying.

template<class RandomItor >
MultiXorPostList::MultiXorPostList ( RandomItor  pl_begin,
RandomItor  pl_end,
MultiMatch matcher_,
Xapian::doccount  db_size_ 
) [inline]

Construct from 2 random-access iterators to a container of PostList*, a pointer to the matcher, and the document collection size.

Definition at line 74 of file multixorpostlist.h.

References n_kids, and plist.

MultiXorPostList::~MultiXorPostList (  ) 

Definition at line 32 of file multixorpostlist.cc.

References n_kids, and plist.


Member Function Documentation

bool MultiXorPostList::at_end (  )  const [virtual]

Return true if the current position is past the last entry in this list.

Implements Xapian::PostingIterator::Internal.

Definition at line 175 of file multixorpostlist.cc.

References did.

Referenced by next(), and skip_to().

Xapian::termcount MultiXorPostList::count_matching_subqs (  )  const [virtual]

Count the number of leaf subqueries which match at the current position.

Reimplemented from Xapian::PostingIterator::Internal.

Definition at line 323 of file multixorpostlist.cc.

References Xapian::PostingIterator::Internal::count_matching_subqs(), did, get_docid(), n_kids, and plist.

void MultiXorPostList::erase_sublist ( size_t  i  )  [inline, private]

Erase a sub-postlist.

Definition at line 60 of file multixorpostlist.h.

References matcher, n_kids, plist, and MultiMatch::recalc_maxweight().

Referenced by next(), and skip_to().

string MultiXorPostList::get_description (  )  const [virtual]

Return a string description of this object.

Implements Xapian::PostingIterator::Internal.

Definition at line 299 of file multixorpostlist.cc.

References Xapian::PostingIterator::Internal::get_description(), n_kids, and plist.

Xapian::docid MultiXorPostList::get_docid (  )  const [virtual]

Return the current docid.

Implements Xapian::PostingIterator::Internal.

Definition at line 137 of file multixorpostlist.cc.

References did.

Referenced by count_matching_subqs(), get_doclength(), get_wdf(), get_weight(), next(), and skip_to().

Xapian::termcount MultiXorPostList::get_doclength (  )  const [virtual]

Return the length of current document.

Implements Xapian::PostingIterator::Internal.

Definition at line 143 of file multixorpostlist.cc.

References Assert, AssertEq, did, get_docid(), Xapian::PostingIterator::Internal::get_doclength(), n_kids, and plist.

Xapian::weight MultiXorPostList::get_maxweight (  )  const [virtual]

Return an upper bound on what get_weight() can return.

Implements Xapian::PostingIterator::Internal.

Definition at line 130 of file multixorpostlist.cc.

References LOGCALL, max_total, and RETURN.

Xapian::doccount MultiXorPostList::get_termfreq_est (  )  const [virtual]

Get an estimate of the number of documents indexed by this term.

It should always be true that: get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max()

Implements Xapian::PostingIterator::Internal.

Definition at line 83 of file multixorpostlist.cc.

References db_size, Xapian::PostingIterator::Internal::get_termfreq_est(), n_kids, plist, rare, and RETURN.

TermFreqs MultiXorPostList::get_termfreq_est_using_stats ( const Xapian::Weight::Internal stats  )  const [virtual]

Get an estimate for the termfreq and reltermfreq, given the stats.

The frequencies may be for a combination of databases, or for just the relevant documents, so the results need not lie in the bounds given by get_termfreq_min() and get_termfreq_max().

Reimplemented from Xapian::PostingIterator::Internal.

Definition at line 100 of file multixorpostlist.cc.

References Assert, Xapian::Weight::Internal::collection_size, LOGCALL, n_kids, plist, TermFreqs::reltermfreq, RETURN, Xapian::Weight::Internal::rset_size, and TermFreqs::termfreq.

Xapian::doccount MultiXorPostList::get_termfreq_max (  )  const [virtual]

Get an upper bound on the number of documents indexed by this term.

Implements Xapian::PostingIterator::Internal.

Definition at line 55 of file multixorpostlist.cc.

References db_size, Xapian::PostingIterator::Internal::get_termfreq_max(), Xapian::PostingIterator::Internal::get_termfreq_min(), n_kids, and plist.

Xapian::doccount MultiXorPostList::get_termfreq_min (  )  const [virtual]

Get a lower bound on the number of documents indexed by this term.

Implements Xapian::PostingIterator::Internal.

Definition at line 43 of file multixorpostlist.cc.

Xapian::termcount MultiXorPostList::get_wdf (  )  const [virtual]

get_wdf() for MultiXorPostlists returns the sum of the wdfs of the sub postlists which match the current docid.

The wdf isn't really meaningful in many situations, but if the lists are being combined as a synonym we want the sum of the wdfs, so we do that in general.

Reimplemented from Xapian::PostingIterator::Internal.

Definition at line 312 of file multixorpostlist.cc.

References did, get_docid(), Xapian::PostingIterator::Internal::get_wdf(), n_kids, and plist.

Xapian::weight MultiXorPostList::get_weight (  )  const [virtual]

Return the weight contribution for the current position.

Implements Xapian::PostingIterator::Internal.

Definition at line 163 of file multixorpostlist.cc.

References Assert, did, get_docid(), Xapian::PostingIterator::Internal::get_weight(), n_kids, and plist.

PostList * MultiXorPostList::next ( Xapian::weight  w_min  )  [virtual]

Advance the current position to the next document in the postlist.

The list starts before the first entry in the list, so next() must be called before any methods which need the context of the current position.

Parameters:
w_min The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore).
Returns:
If a non-NULL pointer is returned, then the caller should substitute the returned pointer for its pointer to us, and then delete us. This "pruning" can only happen for a non-leaf subclass of this class.

Implements Xapian::PostingIterator::Internal.

Definition at line 200 of file multixorpostlist.cc.

References at_end(), did, erase_sublist(), Xapian::PostingIterator::Internal::get_docid(), get_docid(), LOGCALL, matcher, n_kids, Xapian::PostingIterator::Internal::next(), plist, MultiMatch::recalc_maxweight(), and RETURN.

void MultiXorPostList::operator= ( const MultiXorPostList  )  [private]

Don't allow assignment.

Xapian::weight MultiXorPostList::recalc_maxweight (  )  [virtual]

Recalculate the upper bound on what get_weight() can return.

If the tree has pruned, get_maxweight() may use cached values. Calling this method instead forces a full recalculation.

Note that this method may be called after the postlist has reached the end. In this situation, the method should return 0.

Implements Xapian::PostingIterator::Internal.

Definition at line 181 of file multixorpostlist.cc.

References LOGCALL, max_total, n_kids, plist, Xapian::PostingIterator::Internal::recalc_maxweight(), and RETURN.

PostList * MultiXorPostList::skip_to ( Xapian::docid  ,
Xapian::weight  w_min 
) [virtual]

Skip forward to the specified docid.

If the specified docid isn't in the list, position ourselves on the first document after it (or at_end() if no greater docids are present).

Parameters:
w_min The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore).
Returns:
If a non-NULL pointer is returned, then the caller should substitute the returned pointer for its pointer to us, and then delete us. This "pruning" can only happen for a non-leaf subclass of this class.

Implements Xapian::PostingIterator::Internal.

Definition at line 249 of file multixorpostlist.cc.

References AssertEq, at_end(), did, erase_sublist(), Xapian::PostingIterator::Internal::get_docid(), get_docid(), LOGCALL, matcher, n_kids, Xapian::PostingIterator::Internal::next(), plist, MultiMatch::recalc_maxweight(), RETURN, and Xapian::PostingIterator::Internal::skip_to().


Member Data Documentation

The number of documents in the database.

Definition at line 54 of file multixorpostlist.h.

Referenced by get_termfreq_est(), and get_termfreq_max().

The current docid, or zero if we haven't started or are at_end.

Definition at line 42 of file multixorpostlist.h.

Referenced by at_end(), count_matching_subqs(), get_docid(), get_doclength(), get_wdf(), get_weight(), next(), and skip_to().

Pointer to the matcher object, so we can report pruning.

Definition at line 57 of file multixorpostlist.h.

Referenced by erase_sublist(), next(), and skip_to().

Total maximum weight the XOR could possibly return.

Definition at line 51 of file multixorpostlist.h.

Referenced by get_maxweight(), and recalc_maxweight().

size_t MultiXorPostList::n_kids [private]


The documentation for this class was generated from the following files:

Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.