43 lhead(0), rhead(0), lvalid(
false), rvalid(
false),
44 lmax(0), rmax(0), minmax(0), dbsize(dbsize_)
46 LOGCALL_CTOR(MATCH,
"OrPostList", left_ | right_ | matcher_ | dbsize_);
67 LOGLINE(MATCH,
"OR -> AND MAYBE (1)");
82 LOGLINE(MATCH,
"OR -> AND MAYBE (2)");
139 LOGLINE(MATCH,
"OR -> AND (in skip_to)");
143 LOGLINE(MATCH,
"OR -> AND MAYBE (in skip_to) (1)");
148 did = std::max(did,
rhead);
153 LOGLINE(MATCH,
"OR -> AND MAYBE (in skip_to) (2)");
158 did = std::max(did,
lhead);
204 LOGLINE(MATCH,
"OR -> AND (in check)");
208 LOGLINE(MATCH,
"OR -> AND MAYBE (in check) (1)");
212 did = std::max(did,
rhead);
217 LOGLINE(MATCH,
"OR -> AND MAYBE (in check) (2)");
221 did = std::max(did,
lhead);
300 double est = lest + rest - (lest * rest /
dbsize);
301 RETURN(static_cast<Xapian::doccount>(est + 0.5));
308 return l + r - (l * r / n);
315 LOGCALL(MATCH,
TermFreqs,
"OrPostList::get_termfreq_est_using_stats", stats);
321 double freqest, relfreqest, collfreqest;
330 collfreqest =
est(lfreqs.collfreq, rfreqs.collfreq, stats.
total_length);
335 relfreqest =
est(lfreqs.reltermfreq, rfreqs.reltermfreq,
340 static_cast<Xapian::doccount>(relfreqest + 0.5),
341 static_cast<Xapian::termcount>(collfreqest + 0.5)));
356 LOGCALL(MATCH,
double,
"OrPostList::get_weight", NO_ARGS);
367 LOGCALL(MATCH,
double,
"OrPostList::get_maxweight", NO_ARGS);
374 LOGCALL(MATCH,
double,
"OrPostList::recalc_maxweight", NO_ARGS);
387 LOGCALL(MATCH,
bool,
"OrPostList::at_end", NO_ARGS);
408 LOGLINE(MATCH,
"OrPostList::get_doclength() [right docid=" <<
rhead <<
409 "] = " << doclength);
412 LOGLINE(MATCH,
"OrPostList::get_doclength() [left docid=" <<
lhead <<
413 "] = " << doclength);
428 LOGLINE(MATCH,
"OrPostList::get_unique_terms() [right docid=" <<
rhead <<
429 "] = " << unique_terms);
432 LOGLINE(MATCH,
"OrPostList::get_unique_terms() [left docid=" <<
lhead <<
433 "] = " << unique_terms);
Xapian::docid get_docid() const
Return the current docid.
MultiMatch * matcher
The object which is using this postlist to perform a match.
Abstract base class for postlists.
Merged postlist: items from one list, weights from both.
A postlist with weights modified by another postlist.
virtual Xapian::docid get_docid() const =0
Return the current docid.
PostList * l
Left sub-postlist.
virtual void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
#define AssertRel(A, REL, B)
double get_weight() const
Return the weight contribution for the current position.
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.
Xapian::termcount get_wdf() const
get_wdf() for OR postlists returns the sum of the wdfs of the sub postlists which are at the current ...
virtual double recalc_maxweight()=0
Recalculate the upper bound on what get_weight() can return.
double get_maxweight() const
Return an upper bound on what get_weight() can return.
Base class for postlists which are generated by merging two sub-postlists.
static double est(double l, double r, double n)
PostList * sync_rhs(double w_min)
Synchronise the RHS to the LHS after construction.
virtual Xapian::termcount get_unique_terms() const =0
Return the number of unique terms in the current document.
Xapian::doccount collection_size
Number of documents in the collection.
bool skip_to_handling_prune(PostList *&pl, Xapian::docid did, double w_min, MultiMatch *matcher)
Xapian::doccount rset_size
Number of relevant documents in the collection.
void handle_prune(PostList *&kid, PostList *ret)
Utility method, to call recalc_maxweight() and do the pruning if a next() or skip_to() returns non-NU...
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
std::string get_description() const
Return a string description of this object.
virtual Xapian::termcount get_doclength() const
Return the document length of the document the current term comes from.
virtual TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
virtual Xapian::doccount get_termfreq_max() const =0
Get an upper bound on the number of documents indexed by this term.
virtual Xapian::doccount get_termfreq_est() const =0
Get an estimate of the number of documents indexed by this term.
double doclength
A normalised document length.
virtual Xapian::doccount get_termfreq_min() const =0
Get a lower bound on the number of documents indexed by this term.
Class to hold statistics for a given collection.
Internal * next()
Advance the current position to the next document in the postlist.
bool check_handling_prune(PostList *&pl, Xapian::docid did, double w_min, MultiMatch *matcher, bool &valid)
virtual Xapian::termcount get_unique_terms() const
Return the number of unique terms in the document.
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
bool at_end() const
Return true if the current position is past the last entry in this list.
#define AssertParanoid(COND)
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
The frequencies for a term.
bool next_handling_prune(PostList *&pl, double w_min, MultiMatch *matcher)
virtual Xapian::termcount get_doclength() const =0
Return the length of current document.
virtual std::string get_description() const =0
Return a string description of this object.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
PostList * r
Right sub-postlist.
OrPostList(PostList *left_, PostList *right_, MultiMatch *matcher_, Xapian::doccount dbsize_)
virtual Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
Various assertion macros.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Xapian::totallength total_length
Total length of all documents in the collection.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
virtual double get_weight() const =0
Return the weight contribution for the current position.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
Merge two PositionList objects using an OR operation.