xapian-core  2.0.0
extraweightpostlist.h
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 #ifndef XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
22 #define XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
23 
24 #include "wrapperpostlist.h"
25 
26 namespace Xapian {
27 class Weight;
28 }
29 
30 class PostListTree;
31 
35  void operator=(const ExtraWeightPostList&) = delete;
36 
39 
41 
43 
44  double max_extra;
45 
46  public:
48  Xapian::Weight* weight_,
49  PostListTree* pltree_)
50  : WrapperPostList(pl_),
51  weight(weight_),
52  pltree(pltree_),
53  max_extra(weight->get_maxextra()) {}
54 
56  delete weight;
57  }
58 
59  double get_weight(Xapian::termcount doclen,
60  Xapian::termcount unique_terms,
61  Xapian::termcount wdfdocmax) const;
62 
63  double recalc_maxweight();
64 
65  PostList* next(double w_min);
66 
67  PostList* skip_to(Xapian::docid, double w_min);
68 
69  std::string get_description() const;
70 };
71 
72 #endif // XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
PostList which adds on a term-independent weight contribution.
Xapian::Weight * weight
PostList * skip_to(Xapian::docid, double w_min)
Skip forward to the specified docid.
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.
ExtraWeightPostList(PostList *pl_, Xapian::Weight *weight_, PostListTree *pltree_)
void operator=(const ExtraWeightPostList &)=delete
Don't allow assignment.
ExtraWeightPostList(const ExtraWeightPostList &)=delete
Don't allow copying.
double recalc_maxweight()
Recalculate the upper bound on what get_weight() can return.
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
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 docid
A unique identifier for a document.
Definition: types.h:51
Base class for a PostList which wraps another PostList.