xapian-core  1.4.20
orpospostlist.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, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <config.h>
22 
23 #include "orpospostlist.h"
24 
26 {
27  delete pl;
28 }
29 
32 {
33  return pl->get_termfreq_min();
34 }
35 
38 {
39  return pl->get_termfreq_max();
40 }
41 
44 {
45  return pl->get_termfreq_est();
46 }
47 
50 {
51  return pl->get_termfreq_est_using_stats(stats);
52 }
53 
54 double
56 {
57  return pl->get_maxweight();
58 }
59 
62 {
63  return pl->get_docid();
64 }
65 
68 {
69  return pl->get_doclength();
70 }
71 
74 {
75  return pl->get_unique_terms();
76 }
77 
78 double
80 {
81  return pl->get_weight();
82 }
83 
84 bool
86 {
87  return pl->at_end();
88 }
89 
90 double
92 {
93  return pl->recalc_maxweight();
94 }
95 
98 {
99  return position_list.gather(pl);
100 }
101 
102 PostList*
103 OrPosPostList::next(double w_min)
104 {
105  PostList* result = pl->next(w_min);
106  if (result) {
107  delete pl;
108  pl = result;
109  }
110  return NULL;
111 }
112 
113 PostList*
115 {
116  PostList* result = pl->skip_to(did, w_min);
117  if (result) {
118  delete pl;
119  pl = result;
120  }
121  return NULL;
122 }
123 
124 std::string
126 {
127  string desc = "OrPosPostList(";
128  desc += pl->get_description();
129  desc += ')';
130  return desc;
131 }
132 
135 {
136  return pl->get_wdf();
137 }
138 
141 {
142  return pl->count_matching_subqs();
143 }
Abstract base class for postlists.
Definition: postlist.h:37
PostList * pl
Definition: orpospostlist.h:35
virtual Xapian::docid get_docid() const =0
Return the current docid.
TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
Wrapper postlist providing positions for an OR.
virtual Internal * skip_to(Xapian::docid did, double w_min)=0
Skip forward to the specified docid.
virtual double recalc_maxweight()=0
Recalculate the upper bound on what get_weight() can return.
Xapian::docid get_docid() const
Return the current docid.
virtual Xapian::termcount get_unique_terms() const =0
Return the number of unique terms in the current document.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
Xapian::termcount get_doclength() const
Return the length of current document.
bool at_end() const
Return true if the current position is past the last entry in this list.
Internal * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
virtual TermFreqs get_termfreq_est_using_stats(const Xapian::Weight::Internal &stats) const
Get an estimate for the termfreq and reltermfreq, given the stats.
Definition: postlist.cc:36
virtual Xapian::doccount get_termfreq_max() const =0
Get an upper bound on the number of documents indexed by this term.
virtual Xapian::doccount get_termfreq_est() const =0
Get an estimate of the number of documents indexed by this term.
double get_weight() const
Return the weight contribution for the current position.
virtual Xapian::doccount get_termfreq_min() const =0
Get a lower bound on the number of documents indexed by this term.
Class to hold statistics for a given collection.
Internal * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:194
PositionList * gather(PostList *pl)
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
std::string get_description() const
Return a string description of this object.
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
virtual double get_maxweight() const =0
Return an upper bound on what get_weight() can return.
double get_maxweight() const
Return an upper bound on what get_weight() can return.
Xapian::termcount get_unique_terms() const
Return the number of unique terms in the current document.
The frequencies for a term.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.
virtual Internal * next(double w_min)=0
Advance the current position to the next document in the postlist.
virtual Xapian::termcount get_doclength() const =0
Return the length of current document.
virtual std::string get_description() const =0
Return a string description of this object.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:38
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
virtual Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
OrPositionList position_list
Definition: orpospostlist.h:37
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
Abstract base class for iterating term positions in a document.
Definition: positionlist.h:31
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.
virtual Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Definition: postlist.cc:44
virtual double get_weight() const =0
Return the weight contribution for the current position.