1 /** @file msetpostlist.h
2 * @brief PostList returning entries from an MSet
4 /* Copyright (C) 2006,2007,2008,2009,2011,2015 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (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_MSETPOSTLIST_H
22 #define XAPIAN_INCLUDED_MSETPOSTLIST_H
24 #include "xapian/enquire.h"
26 #include "api/omenquireinternal.h"
27 #include "api/postlist.h"
29 /** PostList returning entries from an MSet.
31 * This class is used with the remote backend. We perform a match on the
32 * remote server, then serialise the resulting MSet and pass it back to the
33 * client where we include it in the match by wrapping it in an MSetPostList.
35 class MSetPostList
: public PostList
{
36 /// Don't allow assignment.
37 void operator=(const MSetPostList
&);
39 /// Don't allow copying.
40 MSetPostList(const MSetPostList
&);
42 /// The MSet element that this PostList is pointing to.
45 /// The MSet::Internal object which we're returning entries from.
46 Xapian::Internal::intrusive_ptr
<Xapian::MSet::Internal
> mset_internal
;
48 /** Is the sort order such the relevance decreases down the MSet?
50 * This is true for sort_by_relevance and sort_by_relevance_then_value.
52 bool decreasing_relevance
;
55 MSetPostList(const Xapian::MSet mset
, bool decreasing_relevance_
)
56 : cursor(-1), mset_internal(mset
.internal
),
57 decreasing_relevance(decreasing_relevance_
) { }
59 Xapian::doccount
get_termfreq_min() const;
61 Xapian::doccount
get_termfreq_est() const;
63 Xapian::doccount
get_termfreq_max() const;
65 double get_maxweight() const;
67 Xapian::docid
get_docid() const;
69 double get_weight() const;
71 const std::string
* get_sort_key() const;
73 const std::string
* get_collapse_key() const;
75 /// Not implemented for MSetPostList.
76 Xapian::termcount
get_doclength() const;
78 Xapian::termcount
get_unique_terms() const;
80 double recalc_maxweight();
82 PostList
*next(double w_min
);
84 /// Not meaningful for MSetPostList.
85 PostList
*skip_to(Xapian::docid did
, double w_min
);
89 std::string
get_description() const;
92 #endif /* XAPIAN_INCLUDED_MSETPOSTLIST_H */