xapian-core  1.4.21
synonympostlist.h
Go to the documentation of this file.
1 
4 /* Copyright 2007,2009 Lemur Consulting Ltd
5  * Copyright 2009,2011,2014,2018 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_INCLUDED_SYNONYMPOSTLIST_H
23 #define XAPIAN_INCLUDED_SYNONYMPOSTLIST_H
24 
25 #include "multimatch.h"
26 #include "api/postlist.h"
27 
34 class SynonymPostList : public PostList {
39 
46 
48  const Xapian::Weight * wt;
49 
52 
54  bool want_wdf;
55 
60 
69 
72 
73  public:
74  SynonymPostList(PostList * subtree_, MultiMatch * matcher_,
75  Xapian::termcount doclen_lower_bound_,
76  bool wdf_disjoint_)
77  : subtree(subtree_), matcher(matcher_), wt(NULL),
78  want_doclength(false), want_wdf(false), want_unique_terms(false),
79  wdf_disjoint(wdf_disjoint_),
80  doclen_lower_bound(doclen_lower_bound_) { }
81 
83 
89  void set_weight(const Xapian::Weight * wt_);
90 
91  PostList *next(double w_min);
92  PostList *skip_to(Xapian::docid did, double w_min);
93 
94  double get_weight() const;
95  double get_maxweight() const;
96  double recalc_maxweight();
97 
98  // The following methods just call through to the subtree.
99  Xapian::termcount get_wdf() const;
103  // Note - we don't need to implement get_termfreq_est_using_stats()
104  // because a synonym when used as a child of a synonym will be optimised
105  // to an OR.
106  Xapian::docid get_docid() const;
109  bool at_end() const;
110 
112 
113  std::string get_description() const;
114 };
115 
116 #endif /* XAPIAN_INCLUDED_SYNONYMPOSTLIST_H */
Abstract base class for postlists.
Definition: postlist.h:37
std::string get_description() const
Return a string description of this object.
bool want_doclength
Flag indicating whether the weighting object needs the doclength.
class for performing a match
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
bool want_unique_terms
Flag indicating whether the weighting object needs the number of unique terms.
Xapian::doccount get_termfreq_max() const
Get an upper bound on the number of documents indexed by this term.
bool at_end() const
Return true if the current position is past the last entry in this list.
#define false
Definition: header.h:9
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Abstract base class for postlists.
Xapian::docid get_docid() const
Return the current docid.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
bool wdf_disjoint
Are the subquery's wdf contributions disjoint?
Xapian::termcount get_doclength() const
Return the length of current document.
const Xapian::Weight * wt
Weighting object used for calculating the synonym weights.
PostList * subtree
The subtree, which starts as an OR of all the sub-postlists being joined with Synonym, but may decay into something else.
Internal * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:194
SynonymPostList(PostList *subtree_, MultiMatch *matcher_, Xapian::termcount doclen_lower_bound_, bool wdf_disjoint_)
A postlist comprising several postlists SYNONYMed together.
void set_weight(const Xapian::Weight *wt_)
Set the weight object to be used for the synonym postlist.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:38
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
MultiMatch * matcher
The object which is using this postlist to perform a match.
double get_weight() const
Return the weight contribution for the current position.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
Xapian::termcount get_unique_terms() const
Return the number of unique terms in the current document.
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
Xapian::termcount doclen_lower_bound
Lower bound on doclength in the subdatabase we're working over.
bool want_wdf
Flag indicating whether the weighting object needs the wdf.
Xapian::doccount get_termfreq_min() const
Get a lower bound on the number of documents indexed by this term.
Abstract base class for weighting schemes.
Definition: weight.h:35
double get_maxweight() const
Return an upper bound on what get_weight() can return.
Xapian::doccount get_termfreq_est() const
Get an estimate of the number of documents indexed by this term.