xapian-core  2.0.0
remotesubmatch.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2006,2007,2009,2010,2011,2014,2015,2018,2019,2023 Olly Betts
5  * Copyright (C) 2007,2008 Lemur Consulting Ltd
6  *
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.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_REMOTESUBMATCH_H
23 #define XAPIAN_INCLUDED_REMOTESUBMATCH_H
24 
26 #include "xapian/weight.h"
27 
28 namespace Xapian {
29  class MatchSpy;
30 }
31 
36 
38  RemoteSubMatch(const RemoteSubMatch &) = delete;
39 
42 
45 
46  public:
49  : db(db_), shard(shard_) {}
50 
51  int get_read_fd() const {
52  return db->get_read_fd();
53  }
54 
64  db->accumulate_remote_stats(total_stats);
65  }
66 
76  Xapian::doccount maxitems,
77  Xapian::doccount check_at_least,
78  const Xapian::KeyMaker* sorter,
79  const Xapian::Weight::Internal& total_stats) {
80  db->send_global_stats(first, maxitems, check_at_least, sorter,
81  total_stats);
82  }
83 
85 
90  Xapian::MSet get_mset(const std::vector<opt_ptr_spy>& matchspies) {
91  return db->get_mset(matchspies);
92  }
93 
95  Xapian::doccount get_shard() const { return shard; }
96 };
97 
98 #endif /* XAPIAN_INCLUDED_REMOTESUBMATCH_H */
RemoteDatabase is the baseclass for remote database implementations.
void send_global_stats(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount check_at_least, const Xapian::KeyMaker *sorter, const Xapian::Weight::Internal &stats) const
Send the global stats to the remote server.
int get_read_fd() const
Get the underlying fd this remote connection reads from.
Xapian::MSet get_mset(const std::vector< opt_ptr_spy > &matchspies) const
Get the MSet from the remote server.
void accumulate_remote_stats(Xapian::Weight::Internal &total) const
Accumulate stats from the remote server.
Class for performing matching on a remote database.
RemoteSubMatch(const RemoteSubMatch &)=delete
Don't allow copying.
void start_match(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount check_at_least, const Xapian::KeyMaker *sorter, const Xapian::Weight::Internal &total_stats)
Start the match.
RemoteSubMatch & operator=(const RemoteSubMatch &)=delete
Don't allow assignment.
const RemoteDatabase * db
The remote database.
Xapian::doccount shard
Index of this subdatabase.
RemoteSubMatch(const RemoteDatabase *db_, Xapian::doccount shard_)
Constructor.
int get_read_fd() const
Xapian::doccount get_shard() const
Return the index of the corresponding Database shard.
Xapian::MSet get_mset(const std::vector< opt_ptr_spy > &matchspies)
Get MSet.
void prepare_match(Xapian::Weight::Internal &total_stats)
Fetch and collate statistics.
Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy > opt_ptr_spy
Virtual base class for key making functors.
Definition: keymaker.h:44
Class representing a list of search results.
Definition: mset.h:46
Class to hold statistics for a given collection.
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
RemoteDatabase is the baseclass for remote database implementations.
Weighting scheme API.