Fix whitespace irregularities in code
[xapian.git] / xapian-core / matcher / orpostlist.h
blob52867c4cb71b7914b9f882594d5fdd6b29dbb565
1 /** @file orpostlist.h
2 * @brief OR of two posting lists
3 */
4 /* Copyright 1999,2000,2001 BrightStation PLC
5 * Copyright 2002 Ananova Ltd
6 * Copyright 2003,2004,2009,2010,2011 Olly Betts
7 * Copyright 2009 Lemur Consulting Ltd
8 * Copyright 2010 Richard Boulton
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 * USA
26 #ifndef OM_HGUARD_ORPOSTLIST_H
27 #define OM_HGUARD_ORPOSTLIST_H
29 #include "branchpostlist.h"
31 /** A postlist comprising two postlists ORed together.
33 * This postlist returns a posting if it is in either of the sub-postlists.
34 * The weight for a posting is the sum of the weights of the sub-postings,
35 * if both exist, or the sum of the single sub-posting which exists
36 * otherwise.
38 class OrPostList : public BranchPostList {
39 private:
40 Xapian::docid lhead, rhead;
41 bool lvalid, rvalid;
42 double lmax, rmax, minmax;
43 Xapian::doccount dbsize;
44 public:
45 Xapian::doccount get_termfreq_max() const;
46 Xapian::doccount get_termfreq_min() const;
47 Xapian::doccount get_termfreq_est() const;
48 TermFreqs get_termfreq_est_using_stats(
49 const Xapian::Weight::Internal & stats) const;
51 Xapian::docid get_docid() const;
52 double get_weight() const;
53 double get_maxweight() const;
55 double recalc_maxweight();
57 PostList *next(double w_min);
58 PostList *skip_to(Xapian::docid did, double w_min);
59 PostList *check(Xapian::docid did, double w_min, bool &valid);
60 bool at_end() const;
62 std::string get_description() const;
64 /** Return the document length of the document the current term
65 * comes from.
67 * This is obtained by asking the subpostlist which contains the
68 * current document for the document length. If both subpostlists
69 * are valid, the left one is asked.
71 virtual Xapian::termcount get_doclength() const;
73 /// Return the number of unique terms in the document.
74 virtual Xapian::termcount get_unique_terms() const;
76 OrPostList(PostList * left_,
77 PostList * right_,
78 MultiMatch * matcher_,
79 Xapian::doccount dbsize_);
81 /** get_wdf() for OR postlists returns the sum of the wdfs of the
82 * sub postlists which are at the current document - this is desirable
83 * when the OR is part of a synonym.
85 Xapian::termcount get_wdf() const;
87 Xapian::termcount count_matching_subqs() const;
90 #endif /* OM_HGUARD_ORPOSTLIST_H */