Fix misordered commands in source
[xapian.git] / xapian-core / matcher / valuerangepostlist.h
blob8bdde8c94d53e833af216f251c28dc6451cd7dc9
1 /** @file valuerangepostlist.h
2 * @brief Return document ids matching a range test on a specified doc value.
3 */
4 /* Copyright 2007,2008,2009,2011 Olly Betts
5 * Copyright 2009 Lemur Consulting Ltd
6 * Copyright 2010 Richard Boulton
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.
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.
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
23 #ifndef XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
24 #define XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H
26 #include "api/postlist.h"
27 #include "backends/valuelist.h"
28 #include "xapian/database.h"
30 class ValueRangePostList : public PostList {
31 protected:
32 const Xapian::Database::Internal *db;
34 Xapian::valueno slot;
36 const std::string begin, end;
38 Xapian::doccount db_size;
40 ValueList * valuelist;
42 /// Disallow copying.
43 ValueRangePostList(const ValueRangePostList &);
45 /// Disallow assignment.
46 void operator=(const ValueRangePostList &);
48 public:
49 ValueRangePostList(const Xapian::Database::Internal *db_,
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) { }
55 ~ValueRangePostList();
57 Xapian::doccount get_termfreq_min() const;
59 Xapian::doccount get_termfreq_est() const;
61 Xapian::doccount get_termfreq_max() const;
63 TermFreqs get_termfreq_est_using_stats(
64 const Xapian::Weight::Internal & stats) const;
66 Xapian::docid get_docid() const;
68 double get_weight(Xapian::termcount doclen,
69 Xapian::termcount unique_terms) const;
71 double recalc_maxweight();
73 PositionList * read_position_list();
75 PostList * next(double w_min);
77 PostList * skip_to(Xapian::docid, double w_min);
79 PostList * check(Xapian::docid did, double w_min, bool &valid);
81 bool at_end() const;
83 Xapian::termcount count_matching_subqs() const;
85 std::string get_description() const;
88 #endif /* XAPIAN_INCLUDED_VALUERANGEPOSTLIST_H */