1 /** @file remotesubmatch.cc
2 * @brief SubMatch class for a remote database.
4 /* Copyright (C) 2006,2007,2009,2010,2011,2014,2015 Olly Betts
5 * Copyright (C) 2007,2008 Lemur Consulting Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "remotesubmatch.h"
27 #include "backends/remote/remote-database.h"
28 #include "weight/weightinternal.h"
32 RemoteSubMatch::RemoteSubMatch(const RemoteDatabase
*db_
,
33 const vector
<opt_ptr_spy
>& matchspies_
)
35 matchspies(matchspies_
)
37 LOGCALL_CTOR(MATCH
, "RemoteSubMatch", db_
| matchspies_
);
41 RemoteSubMatch::prepare_match(bool block
,
42 Xapian::Weight::Internal
& total_stats
)
44 LOGCALL(MATCH
, bool, "RemoteSubMatch::prepare_match", block
| total_stats
);
45 Xapian::Weight::Internal remote_stats
;
46 if (!db
->get_remote_stats(block
, remote_stats
)) RETURN(false);
47 total_stats
+= remote_stats
;
52 RemoteSubMatch::start_match(Xapian::doccount first
,
53 Xapian::doccount maxitems
,
54 Xapian::doccount check_at_least
,
55 Xapian::Weight::Internal
& total_stats
)
57 LOGCALL_VOID(MATCH
, "RemoteSubMatch::start_match", first
| maxitems
| check_at_least
| total_stats
);
58 db
->send_global_stats(first
, maxitems
, check_at_least
, total_stats
);