xapian-core  2.0.0
valuerangepostlist.h
Go to the documentation of this file.
1 
4 /* Copyright 2007,2008,2009,2011 Olly Betts
5  * Copyright 2009 Lemur Consulting Ltd
6  * Copyright 2010 Richard Boulton
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see
20  * <https://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
24 #define XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
25 
26 #include "backends/postlist.h"
27 #include "backends/valuelist.h"
28 #include "xapian/database.h"
29 
30 class EstimateOp;
31 
32 class ValueRangePostList : public PostList {
33  protected:
35 
37 
38  const std::string begin, end;
39 
42 
45 
48 
49  ValueList* valuelist = nullptr;
50 
53 
56 
57  public:
59  EstimateOp* estimate_op_,
60  Xapian::doccount termfreq_,
61  Xapian::valueno slot_,
62  const std::string &begin_, const std::string &end_)
63  : db(db_), slot(slot_), begin(begin_), end(end_),
64  estimate_op(estimate_op_)
65  {
66  // Static estimate of termfreq based on the slot bounds and range ends.
67  termfreq = termfreq_;
68  }
69 
71 
72  Xapian::docid get_docid() const;
73 
74  double get_weight(Xapian::termcount doclen,
75  Xapian::termcount unique_terms,
76  Xapian::termcount wdfdocmax) const;
77 
79 
80  double recalc_maxweight();
81 
83 
84  PostList * next(double w_min);
85 
86  PostList * skip_to(Xapian::docid, double w_min);
87 
88  PostList * check(Xapian::docid did, double w_min, bool &valid);
89 
90  bool at_end() const;
91 
93 
94  std::string get_description() const;
95 };
96 
97 #endif /* XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H */
Class for estimating the total number of matching documents.
Definition: estimateop.h:64
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
ValueRangePostList(const ValueRangePostList &)
Disallow copying.
Xapian::termcount get_wdfdocmax() const
std::string get_description() const
Return a string description of this object.
ValueRangePostList(const Xapian::Database::Internal *db_, EstimateOp *estimate_op_, Xapian::doccount termfreq_, Xapian::valueno slot_, const std::string &begin_, const std::string &end_)
const std::string end
const Xapian::Database::Internal * db
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
const std::string begin
void operator=(const ValueRangePostList &)
Disallow assignment.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
Xapian::doccount accepted
Number of times the range test accepted the candidate document.
EstimateOp * estimate_op
Object to report accepted/rejected counts to.
Xapian::doccount rejected
Number of times the range test rejected the candidate document.
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::docid get_docid() const
Return the current docid.
Xapian::valueno slot
Virtual base class for Database internals.
Abstract base class for postlists.
Definition: postlist.h:40
PostList * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:168
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
Definition: postlist.h:52
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:32
Abstract base class for value streams.
Definition: valuelist.h:31
An indexed database of documents.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
unsigned valueno
The number for a value slot in a document.
Definition: types.h:90
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Abstract base class for postlists.
Abstract base class for value streams.