xapian-core  2.0.0
wrapperpostlist.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_WRAPPERPOSTLIST_H
22 #define XAPIAN_INCLUDED_WRAPPERPOSTLIST_H
23 
24 #include "backends/postlist.h"
25 
32 class WrapperPostList : public PostList {
34  void operator=(const WrapperPostList&) = delete;
35 
37  WrapperPostList(const WrapperPostList&) = delete;
38 
39  protected:
41 
42  public:
43  explicit WrapperPostList(PostList* pl_) : pl(pl_) {
45  }
46 
47  ~WrapperPostList() { delete pl; }
48 
49  Xapian::docid get_docid() const;
50 
51  double get_weight(Xapian::termcount doclen,
52  Xapian::termcount unique_terms,
53  Xapian::termcount wdfdocmax) const;
54 
55  bool at_end() const;
56 
57  double recalc_maxweight();
58 
60 
61  PostList* next(double w_min);
62 
63  PostList* skip_to(Xapian::docid, double w_min);
64 
65  std::string get_description() const;
66 
67  Xapian::termcount get_wdf() const;
68 
70 };
71 
72 #endif // XAPIAN_INCLUDED_WRAPPERPOSTLIST_H
Base class for a PostList which wraps another PostList.
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
WrapperPostList(const WrapperPostList &)=delete
Don't allow copying.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Xapian::docid get_docid() const
Return the current docid.
WrapperPostList(PostList *pl_)
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
std::string get_description() const
Return a string description of this object.
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
void operator=(const WrapperPostList &)=delete
Don't allow assignment.
Abstract base class for postlists.
Definition: postlist.h:40
Xapian::doccount get_termfreq() const
Get an estimate of the number of documents this PostList will return.
Definition: postlist.h:67
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
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.