2 * @brief PostList which adds on a term-independent weight contribution
4 /* Copyright 2017 Olly Betts
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.
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.
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
21 #ifndef XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
22 #define XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H
24 #include "wrapperpostlist.h"
32 /// PostList which adds on a term-independent weight contribution
33 class ExtraWeightPostList
: public WrapperPostList
{
34 /// Don't allow assignment.
35 void operator=(const ExtraWeightPostList
&) = delete;
37 /// Don't allow copying.
38 ExtraWeightPostList(const ExtraWeightPostList
&) = delete;
40 Xapian::Weight
* weight
;
47 ExtraWeightPostList(PostList
* pl_
,
48 Xapian::Weight
* weight_
,
49 PostListTree
* pltree_
)
50 : WrapperPostList(pl_
),
53 max_extra(weight
->get_maxextra()) {}
55 ~ExtraWeightPostList() {
59 double get_weight(Xapian::termcount doclen
,
60 Xapian::termcount unique_terms
,
61 Xapian::termcount wdfdocmax
) const;
63 double recalc_maxweight();
65 PostList
* next(double w_min
);
67 PostList
* skip_to(Xapian::docid
, double w_min
);
69 std::string
get_description() const;
72 #endif // XAPIAN_INCLUDED_EXTRAWEIGHTPOSTLIST_H