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);
306 est(
double l,
double r,
double n)
308 return l + r - (l * r / n);
315 LOGCALL(MATCH,
TermFreqs,
"OrPostList::get_termfreq_est_using_stats", stats);
321 double freqest, relfreqest, collfreqest;
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 <<
412 LOGLINE(MATCH,
"OrPostList::get_doclength() [left docid=" <<
lhead <<
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);
Merged postlist: items from one list, weights from both.
bool next_handling_prune(PostList *&pl, double w_min, MultiMatch *matcher)
bool skip_to_handling_prune(PostList *&pl, Xapian::docid did, double w_min, MultiMatch *matcher)
bool check_handling_prune(PostList *&pl, Xapian::docid did, double w_min, MultiMatch *matcher, bool &valid)
A postlist with weights modified by another postlist.
PostList * sync_rhs(double w_min)
Synchronise the RHS to the LHS after construction.
Base class for postlists which are generated by merging two sub-postlists.
PostList * r
Right sub-postlist.
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...
PostList * l
Left sub-postlist.
MultiMatch * matcher
The object which is using this postlist to perform a match.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
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 ...
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
Xapian::docid get_docid() const
Return the current docid.
virtual Xapian::termcount get_doclength() const
Return the document length of the document the current term comes from.
double get_weight() const
Return the weight contribution for the current position.
double get_maxweight() const
Return an upper bound on what get_weight() can return.
std::string get_description() const
Return a string description of this object.
TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.
virtual Xapian::termcount get_unique_terms() const
Return the number of unique terms in the document.
void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
bool at_end() const
Return true if the current position is past the last entry in this list.
OrPostList(PostList *left_, PostList *right_, MultiMatch *matcher_, Xapian::doccount dbsize_)
Abstract base class for postlists.
virtual std::string get_description() const =0
Return a string description of this object.
virtual void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
virtual Xapian::doccount get_termfreq_est() const =0
Get an estimate of the number of documents indexed by this term.
virtual double recalc_maxweight()=0
Recalculate the upper bound on what get_weight() can return.
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 double get_weight() const =0
Return the weight contribution for the current position.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
virtual Xapian::termcount get_doclength() const =0
Return the length of current document.
virtual Xapian::termcount get_unique_terms() const =0
Return the number of unique terms in the current document.
virtual Xapian::docid get_docid() const =0
Return the current docid.
virtual Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Internal * next()
Advance the current position to the next document in the postlist.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
virtual Xapian::doccount get_termfreq_min() const =0
Get a lower bound on the number of documents indexed by this term.
virtual Xapian::doccount get_termfreq_max() const =0
Get an upper bound on the number of documents indexed by this term.
Class to hold statistics for a given collection.
Xapian::totallength total_length
Total length of all documents in the collection.
Xapian::doccount rset_size
Number of relevant documents in the collection.
Xapian::doccount collection_size
Number of documents in the collection.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
double doclength
A normalised document length.
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.
#define AssertParanoid(COND)
#define AssertRel(A, REL, B)
Merge two PositionList objects using an OR operation.
static double est(double l, double r, double n)
The frequencies for a term.
Xapian::termcount collfreq
Xapian::doccount reltermfreq
Xapian::doccount termfreq