34 for (
size_t i = 0; i < n_kids; ++i) {
45 for (
size_t i = 1; i < n_kids; ++i) {
46 res = max(res, plist[i]->get_termfreq_min());
55 for (
size_t i = 1; i < n_kids; ++i) {
57 if (db_size - res <= c)
67 if (
rare(db_size == 0))
73 double scale = 1.0 / db_size;
74 double P_est = plist[0]->get_termfreq_est() * scale;
75 for (
size_t i = 1; i < n_kids; ++i) {
76 double P_i = plist[i]->get_termfreq_est() * scale;
77 P_est += P_i - P_est * P_i;
94 double P_est = freqs.
termfreq * scale;
95 double rtf_scale = 0.0;
101 double cf_scale = 0.0;
105 double Pc_est = freqs.
collfreq * cf_scale;
107 for (
size_t i = 1; i < n_kids; ++i) {
108 freqs = plist[i]->get_termfreq_est_using_stats(stats);
109 double P_i = freqs.
termfreq * scale;
110 P_est += P_i - P_est * P_i;
111 double Pc_i = freqs.
collfreq * cf_scale;
112 Pc_est += Pc_i - Pc_est * Pc_i;
117 Pr_est += Pr_i - Pr_est * Pr_i;
142 bool doclength_set =
false;
143 for (
size_t i = 0; i < n_kids; ++i) {
144 if (plist[i]->get_docid() == did) {
146 AssertEq(doclength, plist[i]->get_doclength());
148 doclength = plist[i]->get_doclength();
149 doclength_set =
true;
162 bool unique_terms_set =
false;
163 for (
size_t i = 0; i < n_kids; ++i) {
164 if (plist[i]->get_docid() == did) {
165 if (unique_terms_set) {
166 AssertEq(unique_terms, plist[i]->get_unique_terms());
168 unique_terms = plist[i]->get_unique_terms();
169 unique_terms_set =
true;
182 for (
size_t i = 0; i < n_kids; ++i) {
183 if (plist[i]->get_docid() == did)
184 res = max(res, plist[i]->get_weight());
198 max_cached = plist[0]->recalc_maxweight();
199 for (
size_t i = 1; i < n_kids; ++i) {
200 max_cached = max(max_cached, plist[i]->recalc_maxweight());
210 for (
size_t i = 0; i < n_kids; ++i) {
214 if (cur_did <= old_did) {
216 if (old_did == 0 || cur_did == old_did) {
217 res = plist[i]->
next(w_min);
219 res = plist[i]->
skip_to(old_did + 1, w_min);
226 if (plist[i]->at_end()) {
232 matcher->recalc_maxweight();
234 cur_did = plist[i]->get_docid();
237 if (did == 0 || cur_did < did) {
255 for (
size_t i = 0; i < n_kids; ++i) {
259 if (cur_did < did_min) {
266 if (plist[i]->at_end()) {
272 matcher->recalc_maxweight();
274 cur_did = plist[i]->get_docid();
277 if (did == 0 || cur_did < did) {
294 desc += plist[0]->get_description();
295 for (
size_t i = 1; i < n_kids; ++i) {
297 desc += plist[i]->get_description();
307 for (
size_t i = 0; i < n_kids; ++i) {
308 if (plist[i]->get_docid() == did)
309 totwdf += plist[i]->get_wdf();
Abstract base class for postlists.
Xapian::docid get_docid() const
Return the current docid.
virtual Xapian::docid get_docid() const =0
Return the current docid.
Xapian::termcount get_unique_terms() const
Return the number of unique terms in the current document.
virtual Internal * skip_to(Xapian::docid did, double w_min)=0
Skip forward to the specified docid.
Xapian::doccount termfreq
Xapian::doccount collection_size
Number of documents in the collection.
Xapian::doccount rset_size
Number of relevant documents in the collection.
double get_weight() const
Return the weight contribution for the current position.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
double doclength
A normalised document length.
Xapian::termcount get_doclength() const
Return the length of current document.
Class to hold statistics for a given collection.
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
Internal * next()
Advance the current position to the next document in the postlist.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
Xapian::termcount collfreq
The frequencies for a term.
virtual Internal * next(double w_min)=0
Advance the current position to the next document in the postlist.
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
std::string get_description() const
Return a string description of this object.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.
double get_maxweight() const
Return an upper bound on what get_weight() can return.
Various assertion macros.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
N-way OR postlist with wt=max(wt_i)
Xapian::totallength total_length
Total length of all documents in the collection.
Xapian::doccount reltermfreq
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Xapian::termcount get_wdf() const
get_wdf() for MaxPostlist returns the sum of the wdfs of the sub postlists which match the current do...