#include <multiandpostlist.h>


Classes | |
| struct | ComparePostListTermFreqAscending |
| Comparison functor which orders PostList* by ascending get_termfreq_est(). More... | |
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 (PostList *l, PostList *r, Xapian::weight lmax, Xapian::weight rmax, MultiMatch *matcher_, Xapian::doccount db_size_, bool check_order=false) | |
| Construct as the decay product of an OrPostList or AndMaybePostList. | |
| ~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. | |
| 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 MultiAndPostlists returns the sum of the wdfs of the sub postlists. | |
| Xapian::termcount | count_matching_subqs () const |
| Count the number of leaf subqueries which match at the current position. | |
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. | |
| void | allocate_plist_and_max_wt () |
| Allocate plist and max_wt arrays of n_kids each. | |
| PostList * | find_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::weight * | max_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. | |
| MultiMatch * | matcher |
| Pointer to the matcher object, so we can report pruning. | |
Definition at line 30 of file multiandpostlist.h.
| MultiAndPostList::MultiAndPostList | ( | const MultiAndPostList & | ) | [private] |
Don't allow copying.
| 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 117 of file multiandpostlist.h.
References allocate_plist_and_max_wt(), n_kids, and plist.
| MultiAndPostList::MultiAndPostList | ( | PostList * | l, | |
| PostList * | r, | |||
| Xapian::weight | lmax, | |||
| Xapian::weight | rmax, | |||
| MultiMatch * | matcher_, | |||
| Xapian::doccount | db_size_, | |||
| bool | check_order = false | |||
| ) | [inline] |
Construct as the decay product of an OrPostList or AndMaybePostList.
check_order If true, then l and r may need swapping to ensure freq_est(l) >= freq_est(r). This should not be necessary for an OrPostList.
Definition at line 137 of file multiandpostlist.h.
References allocate_plist_and_max_wt(), AssertRel, Xapian::PostingIterator::Internal::get_termfreq_est(), max_wt, and plist.
| MultiAndPostList::~MultiAndPostList | ( | ) |
| void MultiAndPostList::allocate_plist_and_max_wt | ( | ) | [private] |
Allocate plist and max_wt arrays of n_kids each.
std::bad_alloc.
Definition at line 29 of file multiandpostlist.cc.
References max_wt, n_kids, and plist.
Referenced by MultiAndPostList().
| 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 170 of file multiandpostlist.cc.
References did.
Referenced by find_next_match().
| 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 93 of file multiandpostlist.h.
References Xapian::PostingIterator::Internal::check(), matcher, new_min(), plist, and MultiMatch::recalc_maxweight().
Referenced by find_next_match().
| Xapian::termcount MultiAndPostList::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 254 of file multiandpostlist.cc.
References Xapian::PostingIterator::Internal::count_matching_subqs(), n_kids, and plist.
| PostList * MultiAndPostList::find_next_match | ( | Xapian::weight | w_min | ) | [private] |
Advance the sublists to the next match.
Definition at line 188 of file multiandpostlist.cc.
References at_end(), check_helper(), did, Xapian::PostingIterator::Internal::get_docid(), n_kids, next_helper(), plist, 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 231 of file multiandpostlist.cc.
References Xapian::PostingIterator::Internal::get_description(), n_kids, and plist.
| Xapian::docid MultiAndPostList::get_docid | ( | ) | const [virtual] |
Return the current docid.
Implements Xapian::PostingIterator::Internal.
Definition at line 142 of file multiandpostlist.cc.
References did.
| Xapian::termcount MultiAndPostList::get_doclength | ( | ) | const [virtual] |
Return the length of current document.
Implements Xapian::PostingIterator::Internal.
Definition at line 148 of file multiandpostlist.cc.
References Assert, AssertEq, did, Xapian::PostingIterator::Internal::get_doclength(), n_kids, and plist.
| Xapian::weight MultiAndPostList::get_maxweight | ( | ) | const [virtual] |
Return an upper bound on what get_weight() can return.
Implements Xapian::PostingIterator::Internal.
Definition at line 136 of file multiandpostlist.cc.
References max_total.
| 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 90 of file multiandpostlist.cc.
References db_size, Xapian::PostingIterator::Internal::get_termfreq_est(), n_kids, and plist.
Referenced by get_termfreq_min().
| TermFreqs MultiAndPostList::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 103 of file multiandpostlist.cc.
References Assert, Xapian::Weight::Internal::collection_size, Xapian::PostingIterator::Internal::get_termfreq_est_using_stats(), if(), LOGCALL, n_kids, plist, TermFreqs::reltermfreq, RETURN, Xapian::Weight::Internal::rset_size, and TermFreqs::termfreq.
| 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 78 of file multiandpostlist.cc.
References Xapian::PostingIterator::Internal::get_termfreq_max(), n_kids, and plist.
| 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 53 of file multiandpostlist.cc.
References AssertRelParanoid, db_size, get_termfreq_est(), Xapian::PostingIterator::Internal::get_termfreq_min(), 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 244 of file multiandpostlist.cc.
References Xapian::PostingIterator::Internal::get_wdf(), 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 159 of file multiandpostlist.cc.
References Assert, did, Xapian::PostingIterator::Internal::get_weight(), n_kids, and plist.
| 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 68 of file multiandpostlist.h.
References max_total, and max_wt.
Referenced by check_helper(), next_helper(), and skip_to_helper().
| 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.
| w_min | The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore). |
Implements Xapian::PostingIterator::Internal.
Definition at line 217 of file multiandpostlist.cc.
References find_next_match(), and next_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 73 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::operator= | ( | const MultiAndPostList & | ) | [private] |
Don't allow assignment.
| 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.
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 176 of file multiandpostlist.cc.
References max_total, max_wt, n_kids, plist, and Xapian::PostingIterator::Internal::recalc_maxweight().
| 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).
| w_min | The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore). |
Implements Xapian::PostingIterator::Internal.
Definition at line 224 of file multiandpostlist.cc.
References find_next_match(), and skip_to_helper().
| 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 83 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().
Xapian::doccount MultiAndPostList::db_size [private] |
The number of documents in the database.
Definition at line 62 of file multiandpostlist.h.
Referenced by get_termfreq_est(), and get_termfreq_min().
Xapian::docid MultiAndPostList::did [private] |
The current docid, or zero if we haven't started or are at_end.
Definition at line 47 of file multiandpostlist.h.
Referenced by at_end(), find_next_match(), get_docid(), get_doclength(), and get_weight().
MultiMatch* MultiAndPostList::matcher [private] |
Pointer to the matcher object, so we can report pruning.
Definition at line 65 of file multiandpostlist.h.
Referenced by check_helper(), next_helper(), and skip_to_helper().
Xapian::weight MultiAndPostList::max_total [private] |
Total maximum weight (== sum of max_wt values).
Definition at line 59 of file multiandpostlist.h.
Referenced by get_maxweight(), new_min(), and recalc_maxweight().
Xapian::weight* MultiAndPostList::max_wt [private] |
Array of maximum weights for the sub-postlists.
Definition at line 56 of file multiandpostlist.h.
Referenced by allocate_plist_and_max_wt(), MultiAndPostList(), new_min(), recalc_maxweight(), and ~MultiAndPostList().
size_t MultiAndPostList::n_kids [private] |
The number of sub-postlists.
Definition at line 50 of file multiandpostlist.h.
Referenced by allocate_plist_and_max_wt(), count_matching_subqs(), find_next_match(), get_description(), get_doclength(), get_termfreq_est(), get_termfreq_est_using_stats(), 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 53 of file multiandpostlist.h.
Referenced by allocate_plist_and_max_wt(), check_helper(), count_matching_subqs(), find_next_match(), get_description(), get_doclength(), get_termfreq_est(), get_termfreq_est_using_stats(), get_termfreq_max(), get_termfreq_min(), get_wdf(), get_weight(), MultiAndPostList(), next_helper(), recalc_maxweight(), skip_to_helper(), and ~MultiAndPostList().