scriptindex: Fix weird error cases
[xapian.git] / xapian-core / matcher / andnotpostlist.h
blob452901c9468b56b9fc09712229049875212c61fc
1 /** @file
2 * @brief Return items which are in A, unless they're in B
3 */
4 /* Copyright 1999,2000,2001 BrightStation PLC
5 * Copyright 2002 Ananova Ltd
6 * Copyright 2003,2004,2009,2011 Olly Betts
7 * Copyright 2009 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_ANDNOTPOSTLIST_H
26 #define OM_HGUARD_ANDNOTPOSTLIST_H
28 #include "branchpostlist.h"
30 /** A postlist generated by taking one postlist (the left-hand postlist),
31 * and removing any documents which are in the other (right-hand) postlist.
33 * The weight for a posting is the weight in the left-hand postlist.
35 class AndNotPostList : public BranchPostList {
36 private:
37 Xapian::docid lhead, rhead;
39 /// Number of documents in the database this postlist is across
40 Xapian::doccount dbsize;
42 PostList *advance_to_next_match(double w_min, PostList *ret);
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;
50 Xapian::docid get_docid() const;
51 double get_weight() const;
52 double get_maxweight() const;
54 double recalc_maxweight();
56 PostList *next(double w_min);
57 PostList *skip_to(Xapian::docid did, double w_min);
58 bool at_end() const;
60 std::string get_description() const;
62 /** Return the document length of the document the current term
63 * comes from.
65 virtual Xapian::termcount get_doclength() const;
67 virtual Xapian::termcount get_unique_terms() const;
69 AndNotPostList(PostList *left,
70 PostList *right,
71 MultiMatch *matcher_,
72 Xapian::doccount dbsize_);
74 PostList *sync_and_skip_to(Xapian::docid id,
75 double w_min,
76 Xapian::docid lh,
77 Xapian::docid rh);
79 /** get_wdf() for ANDNOT postlists returns the wdf of the left hand
80 * side.
82 Xapian::termcount get_wdf() const;
84 Xapian::termcount count_matching_subqs() const;
87 #endif /* OM_HGUARD_ANDNOTPOSTLIST_H */