37 double b,
double bf,
double bl,
41 a = min(a, al - af + 1.0);
42 b = min(b, bl - bf + 1.0);
46 if (al < bf || bl < af) {
48 res =
static_cast<T
>(a + b + 0.5);
65 double arate = a / (al - af + 1);
66 double brate = b / (bl - bf + 1);
68 double r = arate * (bf - af) +
70 (arate + brate - arate * brate) * (al - bf + 1);
71 res =
static_cast<T
>(r + 0.5);
76 : l(left), r(right), pltree(pltree_)
84 if (l_last < l_first) {
88 if (r_last < r_first) {
93 r_tf_est, r_first, r_last,
106 result =
l->
check(did, w_min, *valid_ptr);
130 result =
l->
check(did, w_min, *valid_ptr);
156 return l->
get_weight(doclen, unique_terms, wdfdocmax);
158 return r->
get_weight(doclen, unique_terms, wdfdocmax);
159 return l->
get_weight(doclen, unique_terms, wdfdocmax) +
180 }
else if (
l_did == 0) {
268 bool advance_l = (did >
l_did);
269 bool advance_r = (did >
r_did);
270 if (!advance_l && !advance_r)
330 bool advance_l = (did >
l_did);
331 bool advance_r = (did >
r_did);
332 if (!advance_l && !advance_r) {
358 }
else if (!l_valid) {
371 }
else if (!r_valid) {
425 first = min(first, first2);
426 last = max(last, last2);
432 string desc =
"OrPostList(";
PostList class implementing Query::OP_AND_MAYBE.
PostList class implementing Query::OP_AND_MAYBE.
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
OrPostList(const OrPostList &)=delete
Don't allow copying.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
PostList * decay_to_andmaybe(PostList *left, PostList *right, Xapian::docid did, double w_min, bool *valid_ptr=NULL)
PostList * decay_to_and(Xapian::docid did, double w_min, bool *valid_ptr=NULL)
void get_docid_range(Xapian::docid &first, Xapian::docid &last) const
Get the bounds on the range of docids this PostList can return.
Xapian::docid get_docid() const
Return the current docid.
std::string get_description() const
Return a string description of this object.
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
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.
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.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
virtual Xapian::docid get_docid() const =0
Return the current docid.
virtual double recalc_maxweight()=0
Recalculate the upper bound on what get_weight() can return.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
PostList * next()
Advance the current position to the next document in the postlist.
virtual void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
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.
virtual std::string get_description() const =0
Return a string description of this object.
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
virtual double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const =0
Return the weight contribution for the current position.
virtual Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Return the smaller of two numbers which isn't zero.
constexpr std::enable_if_t< std::is_unsigned_v< T >, T > min_non_zero(const T &a, const T &b)
Return the smaller of two unsigned integers which isn't zero.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
#define AssertRel(A, REL, B)
static void estimate_or_assuming_indep(double a, double af, double al, double b, double bf, double bl, T &res)
PostList class implementing Query::OP_OR.
Class for managing a tree of PostList objects.