22 #ifndef XAPIAN_INCLUDED_ANDPOSTLIST_H
23 #define XAPIAN_INCLUDED_ANDPOSTLIST_H
118 template<
class RandomItor>
132 if (
rare(last < first)) {
139 double r = (last - first + 1);
140 for (
size_t i = 0; i <
n_kids; ++i) {
148 r *= double(est) / (last - first + 1);
155 double lmax,
double rmax,
167 std::swap(lmax, rmax);
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
double * max_wt
Array of maximum weights for the sub-postlists.
void skip_to_helper(size_t n, Xapian::docid did_min, double w_min)
Call skip_to on a sub-postlist n, and handle any pruning.
PostList ** plist
Array of pointers to sub-postlists.
size_t n_kids
The number of sub-postlists.
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
void check_helper(size_t n, Xapian::docid did_min, double w_min, bool &valid)
Call check on a sub-postlist n, and handle any pruning.
PostList * find_next_match(double w_min)
Advance the sublists to the next match.
AndPostList(const AndPostList &)=delete
Don't allow copying.
Xapian::docid get_docid() const
Return the current docid.
AndPostList(RandomItor pl_begin, RandomItor pl_end, PostListTree *matcher_)
Construct from 2 random-access iterators to a container of PostList* and a pointer to the matcher.
Xapian::docid did
The current docid, or zero if we haven't started or are at_end.
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
double max_total
Total maximum weight (== sum of max_wt values).
AndPostList(PostList *l, PostList *r, double lmax, double rmax, PostListTree *matcher_, Xapian::doccount termfreq_)
Construct as the decay product of an OrPostList or AndMaybePostList.
void get_docid_range(Xapian::docid &first, Xapian::docid &last) const
Get the bounds on the range of docids this PostList can return.
void next_helper(size_t n, double w_min)
Call next on a sub-postlist n, and handle any pruning.
void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
PostListTree * matcher
Pointer to the matcher object, so we can report pruning.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
Xapian::termcount get_wdf() const
Get the within-document frequency.
AndPostList & operator=(const AndPostList &)=delete
Don't allow assignment.
bool at_end() const
Return true if the current position is past the last entry in this list.
void allocate_plist_and_max_wt()
Allocate plist and max_wt arrays of n_kids each.
double new_min(double w_min, size_t n)
Calculate the new minimum weight for sub-postlist n.
std::string get_description() const
Return a string description of this object.
Abstract base class for postlists.
virtual PostList * skip_to(Xapian::docid did, double w_min)=0
Skip forward to the specified docid.
virtual PostList * next(double w_min)=0
Advance the current position to the next document in the postlist.
Xapian::doccount get_termfreq() const
Get an estimate of the number of documents this PostList will return.
PostList * next()
Advance the current position to the next document in the postlist.
virtual PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
virtual void get_docid_range(docid &first, docid &last) const
Get the bounds on the range of docids this PostList can return.
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Various assertion macros.
Abstract base class for postlists.
Class for managing a tree of PostList objects.
Comparison functor which orders PostList* by ascending get_termfreq().
bool operator()(const PostList *a, const PostList *b) const
Order by ascending get_termfreq().