Fix testcase unsupportedcheck1 for --disable-backend-remote
[xapian.git] / xapian-core / matcher / orpostlist.h
blobbc0e96fe78575126346ab9f94cba12ace3f9c288
1 /** @file
2 * @brief PostList class implementing Query::OP_OR
3 */
4 /* Copyright 2017 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_ORPOSTLIST_H
22 #define XAPIAN_INCLUDED_ORPOSTLIST_H
24 #include "backends/postlist.h"
26 class PostListTree;
28 /// PostList class implementing Query::OP_OR
29 class OrPostList : public PostList {
30 /// Don't allow assignment.
31 void operator=(const OrPostList&) = delete;
33 /// Don't allow copying.
34 OrPostList(const OrPostList&) = delete;
36 /** Left side.
38 * We optimise assuming this side is more frequent, and so creators should
39 * try to set this side to the side with the higher estimated term
40 * frequency.
42 PostList* l;
44 /// Right side.
45 PostList* r;
47 Xapian::docid l_did = 0;
49 Xapian::docid r_did = 0;
51 double l_max = 0;
53 double r_max = 0;
55 PostListTree* pltree;
57 PostList* decay_to_and(Xapian::docid did,
58 double w_min,
59 bool* valid_ptr = NULL);
61 PostList* decay_to_andmaybe(PostList* left,
62 PostList* right,
63 Xapian::docid did,
64 double w_min,
65 bool* valid_ptr = NULL);
67 public:
68 OrPostList(PostList* left, PostList* right, PostListTree* pltree_);
70 ~OrPostList() {
71 delete l;
72 delete r;
75 Xapian::docid get_docid() const;
77 double get_weight(Xapian::termcount doclen,
78 Xapian::termcount unique_terms,
79 Xapian::termcount wdfdocmax) const;
81 bool at_end() const;
83 double recalc_maxweight();
85 PostList* next(double w_min);
87 PostList* skip_to(Xapian::docid did, double w_min);
89 PostList* check(Xapian::docid did, double w_min, bool& valid);
91 void get_docid_range(Xapian::docid& first, Xapian::docid& last) const;
93 std::string get_description() const;
95 Xapian::termcount get_wdf() const;
97 Xapian::termcount count_matching_subqs() const;
99 void gather_position_lists(OrPositionList* orposlist);
102 #endif // XAPIAN_INCLUDED_ORPOSTLIST_H