39 res =
static_cast<T
>(a + b - (a * b / n) + 0.5);
45 double b,
double bf,
double bl,
49 a = min(a, al - af + 1.0);
50 b = min(b, bl - bf + 1.0);
54 if (al < bf || bl < af) {
56 res =
static_cast<T
>(a + b + 0.5);
73 double arate = a / (al - af + 1);
74 double brate = b / (bl - bf + 1);
76 double r = arate * (bf - af) +
78 (arate + brate - arate * brate) * (al - bf + 1);
79 res =
static_cast<T
>(r + 0.5);
84 : l(left), r(right), pltree(pltree_)
92 if (l_last < l_first) {
96 if (r_last < r_first) {
101 r_tf_est, r_first, r_last,
114 result =
l->
check(did, w_min, *valid_ptr);
138 result =
l->
check(did, w_min, *valid_ptr);
164 return l->
get_weight(doclen, unique_terms, wdfdocmax);
166 return r->
get_weight(doclen, unique_terms, wdfdocmax);
167 return l->
get_weight(doclen, unique_terms, wdfdocmax) +
188 }
else if (
l_did == 0) {
276 bool advance_l = (did >
l_did);
277 bool advance_r = (did >
r_did);
278 if (!advance_l && !advance_r)
338 bool advance_l = (did >
l_did);
339 bool advance_r = (did >
r_did);
340 if (!advance_l && !advance_r) {
366 }
else if (!l_valid) {
379 }
else if (!r_valid) {
433 first = min(first, first2);
434 last = max(last, last2);
440 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 b, double n, T &res)
PostList class implementing Query::OP_OR.
Class for managing a tree of PostList objects.