00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <config.h>
00023 #include "remotesubmatch.h"
00024
00025 #include "msetpostlist.h"
00026 #include "omdebug.h"
00027 #include "remote-database.h"
00028 #include "stats.h"
00029
00030 RemoteSubMatch::RemoteSubMatch(RemoteDatabase *db_, bool decreasing_relevance_)
00031 : db(db_), decreasing_relevance(decreasing_relevance_)
00032 {
00033 DEBUGCALL(MATCH, void, "RemoteSubMatch",
00034 db_ << ", " << decreasing_relevance_);
00035 }
00036
00037 bool
00038 RemoteSubMatch::prepare_match(bool nowait, Stats & total_stats)
00039 {
00040 DEBUGCALL(MATCH, bool, "RemoteSubMatch::prepare_match", nowait);
00041 Stats remote_stats;
00042 if (!db->get_remote_stats(nowait, remote_stats)) RETURN(false);
00043 total_stats += remote_stats;
00044 RETURN(true);
00045 }
00046
00047 void
00048 RemoteSubMatch::start_match(Xapian::doccount first,
00049 Xapian::doccount maxitems,
00050 Xapian::doccount check_at_least,
00051 const Stats & total_stats)
00052 {
00053 DEBUGCALL(MATCH, void, "RemoteSubMatch::start_match",
00054 first << ", " << maxitems << ", " << check_at_least);
00055 db->send_global_stats(first, maxitems, check_at_least, total_stats);
00056 }
00057
00058 PostList *
00059 RemoteSubMatch::get_postlist_and_term_info(MultiMatch *,
00060 map<string, Xapian::MSet::Internal::TermFreqAndWeight> * termfreqandwts)
00061 {
00062 DEBUGCALL(MATCH, PostList *, "RemoteSubMatch::get_postlist_and_term_info",
00063 "[matcher], " << (void*)termfreqandwts);
00064 Xapian::MSet mset;
00065 db->get_mset(mset);
00066 percent_factor = mset.internal->percent_factor;
00067 if (termfreqandwts) *termfreqandwts = mset.internal->termfreqandwts;
00068 return new MSetPostList(mset, decreasing_relevance);
00069 }