xapian-core  1.4.27
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, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
24 #define XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
25 
26 #include "backends/database.h"
27 #include "api/postlist.h"
28 #include "backends/valuelist.h"
29 
30 class ValueRangePostList : public PostList {
31  protected:
33 
35 
36  const std::string begin, end;
37 
39 
41 
44 
46  void operator=(const ValueRangePostList &);
47 
48  public:
50  Xapian::valueno slot_,
51  const std::string &begin_, const std::string &end_)
52  : db(db_), slot(slot_), begin(begin_), end(end_),
53  db_size(db->get_doccount()), valuelist(0) { }
54 
56 
58 
60 
62 
64  const Xapian::Weight::Internal & stats) const;
65 
66  double get_maxweight() const;
67 
68  Xapian::docid get_docid() const;
69 
70  double get_weight() const;
71 
73 
75 
76  double recalc_maxweight();
77 
79 
80  PostList * next(double w_min);
81 
82  PostList * skip_to(Xapian::docid, double w_min);
83 
84  PostList * check(Xapian::docid did, double w_min, bool &valid);
85 
86  bool at_end() const;
87 
89 
90  std::string get_description() const;
91 };
92 
93 #endif /* XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H */
Abstract base class for postlists.
Definition: postlist.h:37
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
double get_maxweight() const
Return an upper bound on what get_weight() can return.
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
std::string get_description() const
Return a string description of this object.
Base class for databases.
Definition: database.h:57
Xapian::termcount get_unique_terms() const
Return the number of unique terms in the current document.
Xapian::docid get_docid() const
Return the current docid.
const std::string begin
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
Abstract base class for postlists.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Xapian::doccount db_size
Class to hold statistics for a given collection.
Internal * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:194
const Xapian::Database::Internal * db
ValueRangePostList(const Xapian::Database::Internal *db_, Xapian::valueno slot_, const std::string &begin_, const std::string &end_)
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 get_doclength() const
Return the length of current document.
const std::string end
Abstract base class for value streams.
Definition: valuelist.h:31
The frequencies for a term.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:38
void operator=(const ValueRangePostList &)
Disallow assignment.
ValueRangePostList(const ValueRangePostList &)
Disallow copying.
unsigned valueno
The number for a value slot in a document.
Definition: types.h:108
Xapian::valueno slot
Abstract base class for value streams.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:31
double get_weight() const
Return the weight contribution for the current position.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.