Branch data Line data Source code
1 : : /* andnotpostlist.h: Return items which are in A, unless they're in B
2 : : *
3 : : * Copyright 1999,2000,2001 BrightStation PLC
4 : : * Copyright 2002 Ananova Ltd
5 : : * Copyright 2003,2004,2009 Olly Betts
6 : : * Copyright 2009 Lemur Consulting Ltd
7 : : *
8 : : * This program is free software; you can redistribute it and/or
9 : : * modify it under the terms of the GNU General Public License as
10 : : * published by the Free Software Foundation; either version 2 of the
11 : : * License, or (at your option) any later version.
12 : : *
13 : : * This program is distributed in the hope that it will be useful,
14 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 : : * GNU General Public License for more details.
17 : : *
18 : : * You should have received a copy of the GNU General Public License
19 : : * along with this program; if not, write to the Free Software
20 : : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 : : * USA
22 : : */
23 : :
24 : : #ifndef OM_HGUARD_ANDNOTPOSTLIST_H
25 : : #define OM_HGUARD_ANDNOTPOSTLIST_H
26 : :
27 : : #include "branchpostlist.h"
28 : :
29 : : /** A postlist generated by taking one postlist (the left-hand postlist),
30 : : * and removing any documents which are in the other (right-hand) postlist.
31 : : *
32 : : * The weight for a posting is the weight in the left-hand postlist.
33 : : */
34 [ + - ][ # # ]: 128 : class AndNotPostList : public BranchPostList {
35 : : private:
36 : : Xapian::docid lhead, rhead;
37 : :
38 : : /// Number of documents in the database this postlist is across
39 : : Xapian::doccount dbsize;
40 : :
41 : : PostList *advance_to_next_match(Xapian::weight w_min, PostList *ret);
42 : : public:
43 : : Xapian::doccount get_termfreq_max() const;
44 : : Xapian::doccount get_termfreq_min() const;
45 : : Xapian::doccount get_termfreq_est() const;
46 : : TermFreqs get_termfreq_est_using_stats(
47 : : const Xapian::Weight::Internal & stats) const;
48 : :
49 : : Xapian::docid get_docid() const;
50 : : Xapian::weight get_weight() const;
51 : : Xapian::weight get_maxweight() const;
52 : :
53 : : Xapian::weight recalc_maxweight();
54 : :
55 : : PostList *next(Xapian::weight w_min);
56 : : PostList *skip_to(Xapian::docid did, Xapian::weight w_min);
57 : : bool at_end() const;
58 : :
59 : : std::string get_description() const;
60 : :
61 : : /** Return the document length of the document the current term
62 : : * comes from.
63 : : */
64 : : virtual Xapian::termcount get_doclength() const;
65 : :
66 : : AndNotPostList(PostList *left,
67 : : PostList *right,
68 : : MultiMatch *matcher_,
69 : : Xapian::doccount dbsize_);
70 : :
71 : : PostList *sync_and_skip_to(Xapian::docid id,
72 : : Xapian::weight w_min,
73 : : Xapian::docid lh,
74 : : Xapian::docid rh);
75 : :
76 : : /** get_wdf() for ANDNOT postlists returns the wdf of the left hand
77 : : * side.
78 : : */
79 : : Xapian::termcount get_wdf() const;
80 : :
81 : : Xapian::termcount count_matching_subqs() const;
82 : : };
83 : :
84 : : #endif /* OM_HGUARD_ANDNOTPOSTLIST_H */
|