2 * @brief base class for sub-matchers
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/omenquireinternal.h"
28 #include "api/postlist.h"
29 #include "xapian/weight.h"
31 class SubMatch
: public Xapian::Internal::intrusive_base
{
33 /** Virtual destructor.
35 * Required because we have virtual methods and delete derived objects
36 * via a pointer to this base class.
38 virtual ~SubMatch() { }
40 /** Fetch and collate statistics.
42 * Before we can calculate term weights we need to fetch statistics from
43 * each database involved and collate them.
45 * @param nowait A RemoteSubMatch may not be able to report statistics
46 * when first asked. If nowait is true, it will return
47 * false in this situation allowing the matcher to ask
48 * other database. If nowait is false, then this method
49 * will block until statistics are available.
51 * @param total_stats A stats object to which the statistics should be
54 * @return If nowait is true and results aren't available yet
55 * then false will be returned and this method must be
56 * called again before the match can proceed. If results
57 * are available or nowait is false, then this method
60 virtual bool prepare_match(bool nowait
,
61 Xapian::Weight::Internal
& total_stats
) = 0;
65 * @param first The first item in the result set to return.
66 * @param maxitems The maximum number of items to return.
67 * @param check_at_least The minimum number of items to check.
68 * @param total_stats The total statistics for the collection.
70 virtual void start_match(Xapian::doccount first
,
71 Xapian::doccount maxitems
,
72 Xapian::doccount check_at_least
,
73 Xapian::Weight::Internal
& total_stats
) = 0;
76 virtual PostList
* get_postlist(MultiMatch
*matcher
,
77 Xapian::termcount
* total_subqs_ptr
) = 0;
80 #endif /* XAPIAN_INCLUDED_SUBMATCH_H */