xapian-core  2.0.0
wrapperpostlist.cc
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 #include <config.h>
22 
23 #include "wrapperpostlist.h"
24 
27 {
28  return pl->get_docid();
29 }
30 
31 double
33  Xapian::termcount unique_terms,
34  Xapian::termcount wdfdocmax) const
35 {
36  return pl->get_weight(doclen, unique_terms, wdfdocmax);
37 }
38 
39 bool
41 {
42  return pl->at_end();
43 }
44 
45 double
47 {
48  return pl->recalc_maxweight();
49 }
50 
53 {
54  return pl->read_position_list();
55 }
56 
57 PostList*
58 WrapperPostList::next(double w_min)
59 {
60  PostList* result = pl->next(w_min);
61  if (result) {
62  delete pl;
63  pl = result;
64  }
65  return NULL;
66 }
67 
68 PostList*
70 {
71  PostList* result = pl->skip_to(did, w_min);
72  if (result) {
73  delete pl;
74  pl = result;
75  }
76  return NULL;
77 }
78 
79 std::string
81 {
82  return pl->get_description();
83 }
84 
87 {
88  return pl->get_wdf();
89 }
90 
93 {
94  return pl->count_matching_subqs();
95 }
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 ...
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.
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.
Abstract base class for postlists.
Definition: postlist.h:40
virtual PostList * skip_to(Xapian::docid did, double w_min)=0
Skip forward to the specified docid.
virtual PostList * next(double w_min)=0
Advance the current position to the next document in the postlist.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Definition: postlist.cc:34
virtual Xapian::docid get_docid() const =0
Return the current docid.
virtual double recalc_maxweight()=0
Recalculate the upper bound on what get_weight() can return.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
virtual PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
Definition: postlist.cc:40
PostList * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:168
virtual std::string get_description() const =0
Return a string description of this object.
virtual double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const =0
Return the weight contribution for the current position.
virtual Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Definition: postlist.cc:59
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
Base class for a PostList which wraps another PostList.