xapian-core  2.0.0
orpostlist.h
Go to the documentation of this file.
1 
4 /* Copyright 2017 Olly Betts
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_ORPOSTLIST_H
22 #define XAPIAN_INCLUDED_ORPOSTLIST_H
23 
24 #include "backends/postlist.h"
25 
26 class PostListTree;
27 
29 class OrPostList : public PostList {
31  void operator=(const OrPostList&) = delete;
32 
34  OrPostList(const OrPostList&) = delete;
35 
43 
46 
48 
50 
51  double l_max = 0;
52 
53  double r_max = 0;
54 
56 
58  double w_min,
59  bool* valid_ptr = NULL);
60 
62  PostList* right,
63  Xapian::docid did,
64  double w_min,
65  bool* valid_ptr = NULL);
66 
67  public:
68  OrPostList(PostList* left, PostList* right, PostListTree* pltree_);
69 
71  delete l;
72  delete r;
73  }
74 
75  Xapian::docid get_docid() const;
76 
77  double get_weight(Xapian::termcount doclen,
78  Xapian::termcount unique_terms,
79  Xapian::termcount wdfdocmax) const;
80 
81  bool at_end() const;
82 
83  double recalc_maxweight();
84 
85  PostList* next(double w_min);
86 
87  PostList* skip_to(Xapian::docid did, double w_min);
88 
89  PostList* check(Xapian::docid did, double w_min, bool& valid);
90 
91  void get_docid_range(Xapian::docid& first, Xapian::docid& last) const;
92 
93  std::string get_description() const;
94 
95  Xapian::termcount get_wdf() const;
96 
98 
99  void gather_position_lists(OrPositionList* orposlist);
100 };
101 
102 #endif // XAPIAN_INCLUDED_ORPOSTLIST_H
PostList class implementing Query::OP_OR.
Definition: orpostlist.h:29
Xapian::docid r_did
Definition: orpostlist.h:49
PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
Definition: orpostlist.cc:336
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Definition: orpostlist.cc:449
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
Definition: orpostlist.cc:172
OrPostList(const OrPostList &)=delete
Don't allow copying.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Definition: orpostlist.cc:459
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
Definition: orpostlist.cc:273
PostList * decay_to_andmaybe(PostList *left, PostList *right, Xapian::docid did, double w_min, bool *valid_ptr=NULL)
Definition: orpostlist.cc:127
PostList * decay_to_and(Xapian::docid did, double w_min, bool *valid_ptr=NULL)
Definition: orpostlist.cc:106
void get_docid_range(Xapian::docid &first, Xapian::docid &last) const
Get the bounds on the range of docids this PostList can return.
Definition: orpostlist.cc:428
PostList * l
Left side.
Definition: orpostlist.h:42
Xapian::docid get_docid() const
Return the current docid.
Definition: orpostlist.cc:151
void operator=(const OrPostList &)=delete
Don't allow assignment.
std::string get_description() const
Return a string description of this object.
Definition: orpostlist.cc:438
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
Definition: orpostlist.cc:159
Xapian::docid l_did
Definition: orpostlist.h:47
double l_max
Definition: orpostlist.h:51
double r_max
Definition: orpostlist.h:53
void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
Definition: orpostlist.cc:469
PostListTree * pltree
Definition: orpostlist.h:55
PostList * r
Right side.
Definition: orpostlist.h:45
bool at_end() const
Return true if the current position is past the last entry in this list.
Definition: orpostlist.cc:419
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
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Abstract base class for postlists.