1 /** @file mergepostlist.h
2 * @brief merge postlists from different databases
4 /* Copyright 1999,2000,2001 BrightStation PLC
5 * Copyright 2002 Ananova Ltd
6 * Copyright 2002,2003,2004,2005,2009,2011,2015,2016 Olly Betts
7 * Copyright 2007 Lemur Consulting Ltd
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
25 #ifndef OM_HGUARD_MERGEPOSTLIST_H
26 #define OM_HGUARD_MERGEPOSTLIST_H
28 #include "api/postlist.h"
31 class ValueStreamDocument
;
33 /** A postlist comprising postlists from different databases merged together.
35 class MergePostList
: public PostList
{
38 MergePostList(const MergePostList
&);
39 MergePostList
& operator=(const MergePostList
&);
43 vector
<PostList
*> plists
;
47 /** The object which is using this postlist to perform
48 * a match. This object needs to be notified when the
49 * tree changes such that the maximum weights need to be
54 /** Document proxy used for valuestream caching.
56 * We need to notify this when the subdatabase changes, as then the
57 * cached valuestreams need to be cleared as they will be for the
60 ValueStreamDocument
& vsdoc
;
63 Xapian::termcount
get_wdf() const;
64 Xapian::doccount
get_termfreq_max() const;
65 Xapian::doccount
get_termfreq_min() const;
66 Xapian::doccount
get_termfreq_est() const;
68 Xapian::docid
get_docid() const;
69 double get_weight() const;
70 const string
* get_sort_key() const;
71 const string
* get_collapse_key() const;
73 double get_maxweight() const;
75 double recalc_maxweight();
77 PostList
*next(double w_min
);
78 PostList
*skip_to(Xapian::docid did
, double w_min
);
81 string
get_description() const;
83 /** Return the document length of the document the current term
86 virtual Xapian::termcount
get_doclength() const;
88 /** Return the number of unique terms in the document. */
89 virtual Xapian::termcount
get_unique_terms() const;
91 Xapian::termcount
count_matching_subqs() const;
93 MergePostList(const std::vector
<PostList
*> & plists_
,
95 ValueStreamDocument
& vsdoc_
)
96 : plists(plists_
), current(-1), matcher(matcher_
), vsdoc(vsdoc_
)
102 #endif /* OM_HGUARD_MERGEPOSTLIST_H */