xapian-core  2.0.0
postlist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007-2022 Olly Betts
5  * Copyright (C) 2009 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_POSTLIST_H
23 #define XAPIAN_INCLUDED_POSTLIST_H
24 
25 #include <string>
26 
27 #include "xapian/intrusive_ptr.h"
28 #include <xapian/types.h>
29 #include <xapian/postingiterator.h>
30 
31 #include "backends/positionlist.h"
32 #include "weight/weightinternal.h"
33 
34 class OrPositionList;
35 
36 namespace Xapian {
37 namespace Internal {
38 
40 class PostList {
42  void operator=(const PostList &) = delete;
43 
45  PostList(const PostList &) = delete;
46 
47  protected:
53 
55  PostList() { }
56 
57  public:
61  virtual ~PostList();
62 
68 
70  virtual Xapian::docid get_docid() const = 0;
71 
76  virtual Xapian::termcount get_wdf() const;
77 
79  virtual double get_weight(Xapian::termcount doclen,
80  Xapian::termcount unique_terms,
81  Xapian::termcount wdfdocmax) const = 0;
82 
84  virtual bool at_end() const = 0;
85 
95  virtual double recalc_maxweight() = 0;
96 
102  virtual PositionList * read_position_list();
103 
109  virtual PositionList * open_position_list() const;
110 
125  virtual PostList* next(double w_min) = 0;
126 
140  virtual PostList* skip_to(Xapian::docid did, double w_min) = 0;
141 
162  virtual PostList* check(Xapian::docid did, double w_min, bool &valid);
163 
168  PostList* next() { return next(0.0); }
169 
174  PostList* skip_to(Xapian::docid did) { return skip_to(did, 0.0); }
175 
177  virtual Xapian::termcount count_matching_subqs() const;
178 
180  virtual void gather_position_lists(OrPositionList* orposlist);
181 
195  virtual void get_docid_range(docid& first, docid& last) const;
196 
198  virtual std::string get_description() const = 0;
199 };
200 
201 }
202 }
203 
205 
206 #endif // XAPIAN_INCLUDED_POSTLIST_H
Abstract base class for postlists.
Definition: postlist.h:40
void operator=(const PostList &)=delete
Don't allow assignment.
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.
Xapian::doccount get_termfreq() const
Get an estimate of the number of documents this PostList will return.
Definition: postlist.h:67
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 ~PostList()
We have virtual methods and want to be able to delete derived classes using a pointer to the base cla...
Definition: postlist.cc:31
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
virtual PositionList * open_position_list() const
Read the position list for the term in the current document and return a pointer to it (not owned by ...
Definition: postlist.cc:46
PostList()
Only constructable as a base class for derived classes.
Definition: postlist.h:55
PostList * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:168
virtual void gather_position_lists(OrPositionList *orposlist)
Gather PositionList* objects for a subtree.
Definition: postlist.cc:66
virtual PostList * check(Xapian::docid did, double w_min, bool &valid)
Check if the specified docid occurs in this postlist.
Definition: postlist.cc:52
PostList * skip_to(Xapian::docid did)
Skip forward to the specified docid.
Definition: postlist.h:174
virtual void get_docid_range(docid &first, docid &last) const
Get the bounds on the range of docids this PostList can return.
Definition: postlist.cc:72
virtual std::string get_description() const =0
Return a string description of this object.
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
Definition: postlist.h:52
virtual double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const =0
Return the weight contribution for the current position.
PostList(const PostList &)=delete
Don't allow copying.
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
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Abstract base class for iterating term positions in a document.
Class for iterating over a list of document ids.
typedefs for Xapian
Xapian::Weight::Internal class, holding database and term statistics.