Fix whitespace irregularities in code
[xapian.git] / xapian-core / matcher / mergepostlist.h
blob58690d5aaec2ab6caa23fc5ca51294048abec613
1 /** @file mergepostlist.h
2 * @brief merge postlists from different databases
3 */
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
22 * USA
25 #ifndef OM_HGUARD_MERGEPOSTLIST_H
26 #define OM_HGUARD_MERGEPOSTLIST_H
28 #include "api/postlist.h"
30 class MultiMatch;
31 class ValueStreamDocument;
33 /** A postlist comprising postlists from different databases merged together.
35 class MergePostList : public PostList {
36 private:
37 // Prevent copying
38 MergePostList(const MergePostList &);
39 MergePostList & operator=(const MergePostList &);
41 double w_max;
43 vector<PostList *> plists;
45 int current;
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
50 * recalculated.
52 MultiMatch *matcher;
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
58 * wrong subdatabase.
60 ValueStreamDocument & vsdoc;
62 public:
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);
79 bool at_end() const;
81 string get_description() const;
83 /** Return the document length of the document the current term
84 * comes from.
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_,
94 MultiMatch *matcher_,
95 ValueStreamDocument & vsdoc_)
96 : plists(plists_), current(-1), matcher(matcher_), vsdoc(vsdoc_)
97 { }
99 ~MergePostList();
102 #endif /* OM_HGUARD_MERGEPOSTLIST_H */