Branch data Line data Source code
1 : : /* orpostlist.h: OR of two posting lists
2 : : *
3 : : * Copyright 1999,2000,2001 BrightStation PLC
4 : : * Copyright 2002 Ananova Ltd
5 : : * Copyright 2003,2004,2009,2010 Olly Betts
6 : : * Copyright 2009 Lemur Consulting Ltd
7 : : * Copyright 2010 Richard Boulton
8 : : *
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.
13 : : *
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.
18 : : *
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
23 : : */
24 : :
25 : : #ifndef OM_HGUARD_ORPOSTLIST_H
26 : : #define OM_HGUARD_ORPOSTLIST_H
27 : :
28 : : #include "branchpostlist.h"
29 : :
30 : : /** A postlist comprising two postlists ORed together.
31 : : *
32 : : * This postlist returns a posting if it is in either of the sub-postlists.
33 : : * The weight for a posting is the sum of the weights of the sub-postings,
34 : : * if both exist, or the sum of the single sub-posting which exists
35 : : * otherwise.
36 : : */
37 [ + - ][ # # ]: 234094 : class OrPostList : public BranchPostList {
38 : : private:
39 : : Xapian::docid lhead, rhead;
40 : : bool lvalid, rvalid;
41 : : Xapian::weight lmax, rmax, minmax;
42 : : Xapian::doccount dbsize;
43 : : public:
44 : : Xapian::doccount get_termfreq_max() const;
45 : : Xapian::doccount get_termfreq_min() const;
46 : : Xapian::doccount get_termfreq_est() const;
47 : : TermFreqs get_termfreq_est_using_stats(
48 : : const Xapian::Weight::Internal & stats) const;
49 : :
50 : : Xapian::docid get_docid() const;
51 : : Xapian::weight get_weight() const;
52 : : Xapian::weight get_maxweight() const;
53 : :
54 : : Xapian::weight recalc_maxweight();
55 : :
56 : : PostList *next(Xapian::weight w_min);
57 : : PostList *skip_to(Xapian::docid did, Xapian::weight w_min);
58 : : PostList *check(Xapian::docid did, Xapian::weight w_min, bool &valid);
59 : : bool at_end() const;
60 : :
61 : : std::string get_description() const;
62 : :
63 : : /** Return the document length of the document the current term
64 : : * comes from.
65 : : *
66 : : * This is obtained by asking the subpostlist which contains the
67 : : * current document for the document length. If both subpostlists
68 : : * are valid, the left one is asked.
69 : : */
70 : : virtual Xapian::termcount get_doclength() const;
71 : :
72 : : OrPostList(PostList * left_,
73 : : PostList * right_,
74 : : MultiMatch * matcher_,
75 : : Xapian::doccount dbsize_);
76 : :
77 : : /** get_wdf() for OR postlists returns the sum of the wdfs of the
78 : : * sub postlists which are at the current document - this is desirable
79 : : * when the OR is part of a synonym.
80 : : */
81 : : Xapian::termcount get_wdf() const;
82 : :
83 : : Xapian::termcount count_matching_subqs() const;
84 : : };
85 : :
86 : : #endif /* OM_HGUARD_ORPOSTLIST_H */
|