2 * @brief class for performing a match
4 /* Copyright 1999,2000,2001 BrightStation PLC
5 * Copyright 2002,2003,2004,2005,2006,2007,2009,2011,2013,2014,2015,2016 Olly Betts
6 * Copyright 2009 Lemur Consulting Ltd
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.
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.
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
24 #ifndef OM_HGUARD_MULTIMATCH_H
25 #define OM_HGUARD_MULTIMATCH_H
27 #include "api/enquireinternal.h"
32 #include "xapian/query.h"
33 #include "xapian/weight.h"
40 /// Vector of the items.
41 std::vector
<Xapian::Internal::intrusive_ptr
<SubMatch
> > leaves
;
43 const Xapian::Database db
;
47 Xapian::doccount collapse_max
;
49 Xapian::valueno collapse_key
;
55 Xapian::Enquire::docid_order order
;
57 Xapian::valueno sort_key
;
59 Xapian::Enquire::Internal::sort_setting sort_by
;
61 bool sort_value_forward
;
66 const Xapian::Weight
* weight
;
68 /** Is each sub-database remote? */
69 vector
<bool> is_remote
;
71 /// The matchspies to use.
72 const vector
<Xapian::Internal::opt_intrusive_ptr
<Xapian::MatchSpy
>> & matchspies
;
74 /// Copying is not permitted.
75 MultiMatch(const MultiMatch
&);
77 /// Assignment is not permitted.
78 void operator=(const MultiMatch
&);
81 /** MultiMatch constructor.
83 * @param db_ The database to use.
84 * @param query The query
85 * @param qlen The query length
86 * @param omrset The relevance set (or NULL for no RSet)
87 * @param time_limit_ Seconds to reduce check_at_least after (or <= 0
89 * @param stats The stats object to add our stats to.
90 * @param wtscheme Weighting scheme
91 * @param matchspies_ Any the MatchSpy objects in use.
92 * @param have_sorter Is there a sorter in use?
93 * @param have_mdecider Is there a Xapian::MatchDecider in use?
95 MultiMatch(const Xapian::Database
&db_
,
96 const Xapian::Query
& query
,
97 Xapian::termcount qlen
,
98 const Xapian::RSet
* omrset
,
99 Xapian::doccount collapse_max_
,
100 Xapian::valueno collapse_key_
,
102 double weight_cutoff_
,
103 Xapian::Enquire::docid_order order_
,
104 Xapian::valueno sort_key_
,
105 Xapian::Enquire::Internal::sort_setting sort_by_
,
106 bool sort_value_forward_
,
108 Xapian::Weight::Internal
& stats
,
109 const Xapian::Weight
*wtscheme
,
110 const vector
<Xapian::Internal::opt_intrusive_ptr
<Xapian::MatchSpy
>> & matchspies_
,
111 bool have_sorter
, bool have_mdecider
);
113 /** Run the match and generate an MSet object.
115 * @param sorter Xapian::KeyMaker functor (or NULL for no KeyMaker)
117 void get_mset(Xapian::doccount first
,
118 Xapian::doccount maxitems
,
119 Xapian::doccount check_at_least
,
121 Xapian::Weight::Internal
& stats
,
122 const Xapian::MatchDecider
* mdecider
,
123 const Xapian::KeyMaker
* sorter
);
125 bool full_db_has_positions() const {
126 return db
.has_positions();
130 #endif /* OM_HGUARD_MULTIMATCH_H */