MultiAndPostList Class Reference

N-way AND postlist. More...

#include <multiandpostlist.h>

Inheritance diagram for MultiAndPostList:

Inheritance graph
[legend]
Collaboration diagram for MultiAndPostList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

template<class RandomItor>
 MultiAndPostList (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.
 ~MultiAndPostList ()
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.
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::doclength 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.
virtual Xapian::termcount get_wdf () const
 get_wdf() for MultiAndPostlists returns the sum of the wdfs of the sub postlists.

Private Member Functions

void operator= (const MultiAndPostList &)
 Don't allow assignment.
 MultiAndPostList (const MultiAndPostList &)
 Don't allow copying.
Xapian::weight new_min (Xapian::weight w_min, size_t n)
 Calculate the new minimum weight for sub-postlist n.
void next_helper (size_t n, Xapian::weight w_min)
 Call next on a sub-postlist n, and handle any pruning.
void skip_to_helper (size_t n, Xapian::docid did_min, Xapian::weight w_min)
 Call skip_to on a sub-postlist n, and handle any pruning.
void check_helper (size_t n, Xapian::docid did_min, Xapian::weight w_min, bool &valid)
 Call check on a sub-postlist n, and handle any pruning.
PostListfind_next_match (Xapian::weight w_min)
 Advance the sublists to the next match.

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::weightmax_wt
 Array of maximum weights for the sub-postlists.
Xapian::weight max_total
 Total maximum weight (== sum of max_wt values).
Xapian::doccount db_size
 The number of documents in the database.
MultiMatchmatcher
 Pointer to the matcher object, so we can report pruning.

Classes

struct  ComparePostListTermFreqAscending
 Comparison functor which orders PostList* by ascending get_termfreq_est(). More...

Detailed Description

N-way AND postlist.

Definition at line 28 of file multiandpostlist.h.


Constructor & Destructor Documentation

MultiAndPostList::MultiAndPostList ( const MultiAndPostList  )  [private]

Don't allow copying.

template<class RandomItor>
MultiAndPostList::MultiAndPostList ( 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 109 of file multiandpostlist.h.

References max_wt, n_kids, and plist.

MultiAndPostList::~MultiAndPostList (  ) 

Definition at line 26 of file multiandpostlist.cc.

References max_wt, n_kids, and plist.


Member Function Documentation

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

Don't allow assignment.

Xapian::weight MultiAndPostList::new_min ( Xapian::weight  w_min,
size_t  n 
) [inline, private]

Calculate the new minimum weight for sub-postlist n.

Definition at line 66 of file multiandpostlist.h.

References max_total, and max_wt.

Referenced by check_helper(), next_helper(), and skip_to_helper().

void MultiAndPostList::next_helper ( size_t  n,
Xapian::weight  w_min 
) [inline, private]

Call next on a sub-postlist n, and handle any pruning.

Definition at line 71 of file multiandpostlist.h.

References matcher, new_min(), Xapian::PostingIterator::Internal::next(), plist, and MultiMatch::recalc_maxweight().

Referenced by find_next_match(), and next().

void MultiAndPostList::skip_to_helper ( size_t  n,
Xapian::docid  did_min,
Xapian::weight  w_min 
) [inline, private]

Call skip_to on a sub-postlist n, and handle any pruning.

Definition at line 81 of file multiandpostlist.h.

References matcher, new_min(), plist, MultiMatch::recalc_maxweight(), and Xapian::PostingIterator::Internal::skip_to().

Referenced by find_next_match(), and skip_to().

void MultiAndPostList::check_helper ( size_t  n,
Xapian::docid  did_min,
Xapian::weight  w_min,
bool &  valid 
) [inline, private]

Call check on a sub-postlist n, and handle any pruning.

Definition at line 91 of file multiandpostlist.h.

References Xapian::PostingIterator::Internal::check(), matcher, new_min(), plist, and MultiMatch::recalc_maxweight().

Referenced by find_next_match().

PostList * MultiAndPostList::find_next_match ( Xapian::weight  w_min  )  [private]

Advance the sublists to the next match.

Definition at line 140 of file multiandpostlist.cc.

References at_end(), check_helper(), did, Xapian::PostingIterator::Internal::get_docid(), n_kids, next_helper(), plist, and skip_to_helper().

Referenced by next(), and skip_to().

Xapian::doccount MultiAndPostList::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 38 of file multiandpostlist.cc.

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

Xapian::doccount MultiAndPostList::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 63 of file multiandpostlist.cc.

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

Xapian::doccount MultiAndPostList::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 75 of file multiandpostlist.cc.

References db_size, n_kids, and plist.

Referenced by get_termfreq_min().

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

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

Implements Xapian::PostingIterator::Internal.

Definition at line 88 of file multiandpostlist.cc.

References max_total.

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

Return the current docid.

Implements Xapian::PostingIterator::Internal.

Definition at line 94 of file multiandpostlist.cc.

References did.

Xapian::doclength MultiAndPostList::get_doclength (  )  const [virtual]

Return the length of current document.

Implements Xapian::PostingIterator::Internal.

Definition at line 100 of file multiandpostlist.cc.

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

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

Return the weight contribution for the current position.

Implements Xapian::PostingIterator::Internal.

Definition at line 111 of file multiandpostlist.cc.

References Assert, did, n_kids, and plist.

bool MultiAndPostList::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 122 of file multiandpostlist.cc.

References did.

Referenced by find_next_match().

Xapian::weight MultiAndPostList::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.

Implements Xapian::PostingIterator::Internal.

Definition at line 128 of file multiandpostlist.cc.

References max_total, max_wt, n_kids, and plist.

PostList * MultiAndPostList::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 169 of file multiandpostlist.cc.

References find_next_match(), and next_helper().

PostList * MultiAndPostList::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 176 of file multiandpostlist.cc.

References find_next_match(), and skip_to_helper().

std::string MultiAndPostList::get_description (  )  const [virtual]

Return a string description of this object.

Implements Xapian::PostingIterator::Internal.

Definition at line 183 of file multiandpostlist.cc.

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

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

get_wdf() for MultiAndPostlists returns the sum of the wdfs of the sub postlists.

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 196 of file multiandpostlist.cc.

References n_kids, and plist.


Member Data Documentation

Xapian::docid MultiAndPostList::did [private]

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

Definition at line 45 of file multiandpostlist.h.

Referenced by at_end(), find_next_match(), get_docid(), get_doclength(), and get_weight().

size_t MultiAndPostList::n_kids [private]

The number of sub-postlists.

Definition at line 48 of file multiandpostlist.h.

Referenced by find_next_match(), get_description(), get_doclength(), get_termfreq_est(), get_termfreq_max(), get_termfreq_min(), get_wdf(), get_weight(), MultiAndPostList(), recalc_maxweight(), and ~MultiAndPostList().

PostList** MultiAndPostList::plist [private]

Array of pointers to sub-postlists.

Definition at line 51 of file multiandpostlist.h.

Referenced by check_helper(), find_next_match(), get_description(), get_doclength(), get_termfreq_est(), get_termfreq_max(), get_termfreq_min(), get_wdf(), get_weight(), MultiAndPostList(), next_helper(), recalc_maxweight(), skip_to_helper(), and ~MultiAndPostList().

Xapian::weight* MultiAndPostList::max_wt [private]

Array of maximum weights for the sub-postlists.

Definition at line 54 of file multiandpostlist.h.

Referenced by MultiAndPostList(), new_min(), recalc_maxweight(), and ~MultiAndPostList().

Xapian::weight MultiAndPostList::max_total [private]

Total maximum weight (== sum of max_wt values).

Definition at line 57 of file multiandpostlist.h.

Referenced by get_maxweight(), new_min(), and recalc_maxweight().

Xapian::doccount MultiAndPostList::db_size [private]

The number of documents in the database.

Definition at line 60 of file multiandpostlist.h.

Referenced by get_termfreq_est(), and get_termfreq_min().

MultiMatch* MultiAndPostList::matcher [private]

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

Definition at line 63 of file multiandpostlist.h.

Referenced by check_helper(), next_helper(), and skip_to_helper().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.