xapian-check-patch: Check for lines > 80 columns
[xapian.git] / xapian-core / common / submatch.h
blobe245dee1a620826100c6ea42d801d36cc0c4a5fd
1 /** @file submatch.h
2 * @brief base class for sub-matchers
3 */
4 /* Copyright (C) 2006,2007,2009,2011,2014 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_SUBMATCH_H
22 #define XAPIAN_INCLUDED_SUBMATCH_H
24 #include "xapian/intrusive_ptr.h"
25 #include <xapian/types.h>
27 #include "api/postlist.h"
28 #include "xapian/weight.h"
30 class PostListTree;
32 class SubMatch : public Xapian::Internal::intrusive_base {
33 public:
34 /** Virtual destructor.
36 * Required because we have virtual methods and delete derived objects
37 * via a pointer to this base class.
39 virtual ~SubMatch() { }
41 /** Fetch and collate statistics.
43 * Before we can calculate term weights we need to fetch statistics from
44 * each database involved and collate them.
46 * @param nowait A RemoteSubMatch may not be able to report statistics
47 * when first asked. If nowait is true, it will return
48 * false in this situation allowing the matcher to ask
49 * other database. If nowait is false, then this method
50 * will block until statistics are available.
52 * @param total_stats A stats object to which the statistics should be
53 * added.
55 * @return If nowait is true and results aren't available yet
56 * then false will be returned and this method must be
57 * called again before the match can proceed. If results
58 * are available or nowait is false, then this method
59 * returns true.
61 virtual bool prepare_match(bool nowait,
62 Xapian::Weight::Internal & total_stats) = 0;
64 /** Start the match.
66 * @param first The first item in the result set to return.
67 * @param maxitems The maximum number of items to return.
68 * @param check_at_least The minimum number of items to check.
69 * @param total_stats The total statistics for the collection.
71 virtual void start_match(Xapian::doccount first,
72 Xapian::doccount maxitems,
73 Xapian::doccount check_at_least,
74 Xapian::Weight::Internal & total_stats) = 0;
76 /// Get PostList.
77 virtual PostList * get_postlist(PostListTree *matcher,
78 Xapian::termcount * total_subqs_ptr) = 0;
81 #endif /* XAPIAN_INCLUDED_SUBMATCH_H */