xapian-core  2.0.0
synonympostlist.h
Go to the documentation of this file.
1 
4 /* Copyright 2007,2009 Lemur Consulting Ltd
5  * Copyright 2009,2011,2014,2017,2018,2024 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, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_SYNONYMPOSTLIST_H
23 #define XAPIAN_INCLUDED_SYNONYMPOSTLIST_H
24 
25 #include "wrapperpostlist.h"
26 
28 
29 class PostListTree;
30 
42  const Xapian::Weight* wt = nullptr;
43 
45  bool want_wdf = false;
46 
48  bool want_wdfdocmax = false;
49 
64 
66 
67  public:
69  PostListTree* pltree_,
70  bool needs_doclen_)
71  : WrapperPostList(subtree),
72  needs_doclen(needs_doclen_),
73  pltree(pltree_) { }
74 
76 
82  void set_weight(const Xapian::Weight * wt_);
83 
84  PostList *next(double w_min);
85  PostList *skip_to(Xapian::docid did, double w_min);
86 
87  double get_weight(Xapian::termcount doclen,
88  Xapian::termcount unique_terms,
89  Xapian::termcount wdfdocmax) const;
90  double recalc_maxweight();
91 
93 
94  std::string get_description() const;
95 };
96 
97 #endif /* XAPIAN_INCLUDED_SYNONYMPOSTLIST_H */
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.
const Xapian::Weight * wt
Weighting object used for calculating the synonym weights.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
double get_weight(Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
Return the weight contribution for the current position.
bool want_wdf
Flag indicating whether the weighting object needs the wdf.
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
PostListTree * pltree
bool want_wdfdocmax
Flag indicating whether the weighting object needs the wdfdocmax.
SynonymPostList(PostList *subtree, PostListTree *pltree_, bool needs_doclen_)
Xapian::termcount count_matching_subqs() const
Count the number of leaf subqueries which match at the current position.
bool needs_doclen
Does the synonym need the document length?
std::string get_description() const
Return a string description of this object.
Base class for a PostList which wraps another PostList.
Abstract base class for postlists.
Definition: postlist.h:40
PostList * next()
Advance the current position to the next document in the postlist.
Definition: postlist.h:168
Abstract base class for weighting schemes.
Definition: weight.h:38
Virtual base class for Database internals.
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.