diff --git a/xapian-core/api/editdistance.h b/xapian-core/api/editdistance.h
index 4ab7824..f049dbe 100644
|
a
|
b
|
|
| | 1 | |
| 1 | 2 | /** @file editdistance.h |
| 2 | 3 | * @brief Edit distance calculation algorithm. |
| 3 | 4 | */ |
diff --git a/xapian-core/api/omdatabase.cc b/xapian-core/api/omdatabase.cc
index 8953cb6..211ed04 100644
|
a
|
b
|
Database::get_uuid() const
|
| 740 | 740 | RETURN(uuid); |
| 741 | 741 | } |
| 742 | 742 | |
| | 743 | void |
| | 744 | Database::set_error_handler(ErrorHandler* error_handler_) |
| | 745 | { |
| | 746 | LOGCALL(API, std::string, "Database::set_error_handler", error_handler_); |
| | 747 | vector<intrusive_ptr<Database::Internal> >::const_iterator i; |
| | 748 | for (i = internal.begin(); i != internal.end(); ++i) { |
| | 749 | (*i)->error_handler = error_handler_; |
| | 750 | } |
| | 751 | } |
| | 752 | |
| | 753 | |
| 743 | 754 | /////////////////////////////////////////////////////////////////////////// |
| 744 | 755 | |
| 745 | 756 | WritableDatabase::WritableDatabase() : Database() |
diff --git a/xapian-core/api/omenquire.cc b/xapian-core/api/omenquire.cc
index 33da93b..75264d6 100644
|
a
|
b
|
Enquire::Internal::get_mset(Xapian::doccount first, Xapian::doccount maxitems,
|
| 680 | 680 | collapse_max, collapse_key, |
| 681 | 681 | percent_cutoff, weight_cutoff, |
| 682 | 682 | order, sort_key, sort_by, sort_value_forward, |
| 683 | | errorhandler, stats, weight, spies, |
| | 683 | stats, weight, spies, |
| 684 | 684 | (sorter != NULL), |
| 685 | 685 | (mdecider != NULL)); |
| 686 | 686 | // Run query and put results into supplied Xapian::MSet object. |
| … |
… |
Enquire::Internal::get_description() const
|
| 829 | 829 | void |
| 830 | 830 | Enquire::Internal::request_doc(const Xapian::Internal::MSetItem &item) const |
| 831 | 831 | { |
| 832 | | try { |
| 833 | | unsigned int multiplier = db.internal.size(); |
| | 832 | unsigned int multiplier = db.internal.size(); |
| 834 | 833 | |
| 835 | | Xapian::docid realdid = (item.did - 1) / multiplier + 1; |
| 836 | | Xapian::doccount dbnumber = (item.did - 1) % multiplier; |
| | 834 | Xapian::docid realdid = (item.did - 1) / multiplier + 1; |
| | 835 | Xapian::doccount dbnumber = (item.did - 1) % multiplier; |
| 837 | 836 | |
| | 837 | try { |
| 838 | 838 | db.internal[dbnumber]->request_document(realdid); |
| 839 | 839 | } catch (Error & e) { |
| 840 | | if (errorhandler) (*errorhandler)(e); |
| | 840 | ErrorHandler* error_handler = db.internal[dbnumber]->error_handler; |
| | 841 | if (error_handler) (*error_handler)(e); |
| 841 | 842 | throw; |
| 842 | 843 | } |
| 843 | 844 | } |
| … |
… |
Enquire::Internal::request_doc(const Xapian::Internal::MSetItem &item) const
|
| 845 | 846 | Document |
| 846 | 847 | Enquire::Internal::read_doc(const Xapian::Internal::MSetItem &item) const |
| 847 | 848 | { |
| 848 | | try { |
| 849 | | unsigned int multiplier = db.internal.size(); |
| | 849 | unsigned int multiplier = db.internal.size(); |
| 850 | 850 | |
| 851 | | Xapian::docid realdid = (item.did - 1) / multiplier + 1; |
| 852 | | Xapian::doccount dbnumber = (item.did - 1) % multiplier; |
| | 851 | Xapian::docid realdid = (item.did - 1) / multiplier + 1; |
| | 852 | Xapian::doccount dbnumber = (item.did - 1) % multiplier; |
| 853 | 853 | |
| | 854 | try { |
| 854 | 855 | Xapian::Document::Internal *doc; |
| 855 | 856 | doc = db.internal[dbnumber]->collect_document(realdid); |
| 856 | 857 | return Document(doc); |
| 857 | 858 | } catch (Error & e) { |
| 858 | | if (errorhandler) (*errorhandler)(e); |
| | 859 | ErrorHandler* error_handler = db.internal[dbnumber]->error_handler; |
| | 860 | if (error_handler) (*error_handler)(e); |
| 859 | 861 | throw; |
| 860 | 862 | } |
| 861 | 863 | } |
| … |
… |
const Query &
|
| 902 | 904 | Enquire::get_query() const |
| 903 | 905 | { |
| 904 | 906 | LOGCALL(API, const Xapian::Query &, "Xapian::Enquire::get_query", NO_ARGS); |
| 905 | | try { |
| 906 | | RETURN(internal->get_query()); |
| 907 | | } catch (Error & e) { |
| 908 | | if (internal->errorhandler) (*internal->errorhandler)(e); |
| 909 | | throw; |
| 910 | | } |
| | 907 | RETURN(internal->get_query()); |
| 911 | 908 | } |
| 912 | 909 | |
| 913 | 910 | void |
diff --git a/xapian-core/backends/database.cc b/xapian-core/backends/database.cc
index 53dc6d74..6c10eeb 100644
|
a
|
b
|
Database::Internal::keep_alive()
|
| 49 | 49 | // For the normal case of local databases, nothing needs to be done. |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | | |
| 53 | 52 | Xapian::doccount |
| 54 | 53 | Database::Internal::get_value_freq(Xapian::valueno) const |
| 55 | 54 | { |
diff --git a/xapian-core/backends/database.h b/xapian-core/backends/database.h
index 3d95921..8595945 100644
|
a
|
b
|
|
| 33 | 33 | #include <xapian/types.h> |
| 34 | 34 | #include <xapian/database.h> |
| 35 | 35 | #include <xapian/document.h> |
| | 36 | #include <xapian/errorhandler.h> |
| 36 | 37 | #include <xapian/positioniterator.h> |
| 37 | 38 | #include <xapian/termiterator.h> |
| 38 | 39 | #include <xapian/valueiterator.h> |
| … |
… |
class Database::Internal : public Xapian::Internal::intrusive_base {
|
| 75 | 76 | bool transaction_active() const { return int(transaction_state) > 0; } |
| 76 | 77 | |
| 77 | 78 | /** Create a database - called only by derived classes. */ |
| 78 | | Internal() : transaction_state(TRANSACTION_NONE) { } |
| | 79 | Internal() : transaction_state(TRANSACTION_NONE), error_handler(NULL) { } |
| 79 | 80 | |
| 80 | 81 | /** Internal method to perform cleanup when a writable database is |
| 81 | 82 | * destroyed with uncommitted changes. |
| … |
… |
class Database::Internal : public Xapian::Internal::intrusive_base {
|
| 108 | 109 | */ |
| 109 | 110 | virtual void keep_alive(); |
| 110 | 111 | |
| | 112 | /** Internal pointer to the database's ErrorHandler |
| | 113 | */ |
| | 114 | ErrorHandler* error_handler; |
| | 115 | |
| 111 | 116 | ////////////////////////////////////////////////////////////////// |
| 112 | 117 | // Database statistics: |
| 113 | 118 | // ==================== |
diff --git a/xapian-core/include/xapian/database.h b/xapian-core/include/xapian/database.h
index 243bf6d..7719577 100644
|
a
|
b
|
|
| 30 | 30 | #include <vector> |
| 31 | 31 | |
| 32 | 32 | #include <xapian/attributes.h> |
| | 33 | #include <xapian/errorhandler.h> |
| 33 | 34 | #include <xapian/intrusive_ptr.h> |
| 34 | 35 | #include <xapian/types.h> |
| 35 | 36 | #include <xapian/positioniterator.h> |
| … |
… |
class XAPIAN_VISIBILITY_DEFAULT Database {
|
| 508 | 509 | * @param opts Options to use for check |
| 509 | 510 | */ |
| 510 | 511 | static size_t check(const std::string & path, int opts); |
| | 512 | |
| | 513 | /** Set an ErrorHandler for database. This will be applied to all |
| | 514 | * databases in internal. |
| | 515 | * |
| | 516 | * @param error_handler_ ErrorHandler* to use |
| | 517 | */ |
| | 518 | void set_error_handler(ErrorHandler* error_handler_); |
| | 519 | |
| 511 | 520 | }; |
| 512 | 521 | |
| 513 | 522 | /** This class provides read/write access to a database. |
diff --git a/xapian-core/include/xapian/enquire.h b/xapian-core/include/xapian/enquire.h
index d16d7e2..0f63d8a 100644
|
a
|
b
|
class XAPIAN_VISIBILITY_DEFAULT Enquire {
|
| 711 | 711 | |
| 712 | 712 | /** Get the query which has been set. |
| 713 | 713 | * This is only valid after set_query() has been called. |
| 714 | | * |
| 715 | | * @exception Xapian::InvalidArgumentError will be thrown if query has |
| 716 | | * not yet been set. |
| 717 | 714 | */ |
| 718 | 715 | const Xapian::Query & get_query() const; |
| 719 | 716 | |
diff --git a/xapian-core/matcher/mergepostlist.cc b/xapian-core/matcher/mergepostlist.cc
index b32f632..7ce3f49 100644
|
a
|
b
|
|
| 30 | 30 | #include "debuglog.h" |
| 31 | 31 | #include "omassert.h" |
| 32 | 32 | #include "valuestreamdocument.h" |
| 33 | | #include "xapian/errorhandler.h" |
| 34 | 33 | |
| 35 | 34 | // NB don't prune - even with one sublist we still translate docids... |
| 36 | 35 | |
| … |
… |
MergePostList::next(double w_min)
|
| 59 | 58 | if (unsigned(current) >= plists.size()) break; |
| 60 | 59 | vsdoc.new_subdb(current); |
| 61 | 60 | } catch (Xapian::Error & e) { |
| | 61 | //TODO: add test coverage |
| | 62 | Xapian::ErrorHandler* errorhandler = handlers[current]; |
| 62 | 63 | if (errorhandler) { |
| 63 | 64 | LOGLINE(EXCEPTION, "Calling error handler in MergePostList::next()."); |
| 64 | 65 | (*errorhandler)(e); |
| … |
… |
MergePostList::recalc_maxweight()
|
| 176 | 177 | double w = (*i)->recalc_maxweight(); |
| 177 | 178 | if (w > w_max) w_max = w; |
| 178 | 179 | } catch (Xapian::Error & e) { |
| 179 | | if (errorhandler) { |
| | 180 | //TODO: add test coverage |
| | 181 | Xapian::ErrorHandler* errorhandler_ = handlers[current]; |
| | 182 | if (errorhandler_) { |
| 180 | 183 | LOGLINE(EXCEPTION, "Calling error handler in MergePostList::recalc_maxweight()."); |
| 181 | | (*errorhandler)(e); |
| | 184 | (*errorhandler_)(e); |
| 182 | 185 | |
| 183 | 186 | if (current == i - plists.begin()) { |
| 184 | 187 | // Fatal error |
diff --git a/xapian-core/matcher/mergepostlist.h b/xapian-core/matcher/mergepostlist.h
index f222fa2..f520445 100644
|
a
|
b
|
|
| 26 | 26 | #define OM_HGUARD_MERGEPOSTLIST_H |
| 27 | 27 | |
| 28 | 28 | #include "api/postlist.h" |
| | 29 | #include "xapian/errorhandler.h" |
| 29 | 30 | |
| 30 | 31 | class MultiMatch; |
| 31 | 32 | class ValueStreamDocument; |
| … |
… |
class MergePostList : public PostList {
|
| 59 | 60 | */ |
| 60 | 61 | ValueStreamDocument & vsdoc; |
| 61 | 62 | |
| 62 | | Xapian::ErrorHandler * errorhandler; |
| | 63 | /** |
| | 64 | * |
| | 65 | */ |
| | 66 | std::vector<Xapian::ErrorHandler *> handlers; |
| | 67 | |
| 63 | 68 | public: |
| 64 | 69 | Xapian::termcount get_wdf() const; |
| 65 | 70 | Xapian::doccount get_termfreq_max() const; |
| … |
… |
class MergePostList : public PostList {
|
| 90 | 95 | MergePostList(const std::vector<PostList *> & plists_, |
| 91 | 96 | MultiMatch *matcher_, |
| 92 | 97 | ValueStreamDocument & vsdoc_, |
| 93 | | Xapian::ErrorHandler * errorhandler_) |
| | 98 | std::vector<Xapian::ErrorHandler *> & handlers_) |
| 94 | 99 | : plists(plists_), current(-1), matcher(matcher_), vsdoc(vsdoc_), |
| 95 | | errorhandler(errorhandler_) { } |
| | 100 | handlers(handlers_) |
| | 101 | { } |
| 96 | 102 | |
| 97 | 103 | ~MergePostList(); |
| 98 | 104 | }; |
diff --git a/xapian-core/matcher/multimatch.cc b/xapian-core/matcher/multimatch.cc
index 654908a..64186ca 100644
|
a
|
b
|
split_rset_by_db(const Xapian::RSet * rset,
|
| 136 | 136 | */ |
| 137 | 137 | static void |
| 138 | 138 | prepare_sub_matches(vector<intrusive_ptr<SubMatch> > & leaves, |
| 139 | | Xapian::ErrorHandler * errorhandler, |
| 140 | | Xapian::Weight::Internal & stats) |
| | 139 | Xapian::Weight::Internal & stats, |
| | 140 | const Xapian::Database & db) |
| 141 | 141 | { |
| 142 | | LOGCALL_STATIC_VOID(MATCH, "prepare_sub_matches", leaves | errorhandler | stats); |
| | 142 | LOGCALL_STATIC_VOID(MATCH, "prepare_sub_matches", leaves | stats); |
| 143 | 143 | // We use a vector<bool> to track which SubMatches we're already prepared. |
| 144 | 144 | vector<bool> prepared; |
| 145 | 145 | prepared.resize(leaves.size(), false); |
| … |
… |
prepare_sub_matches(vector<intrusive_ptr<SubMatch> > & leaves,
|
| 155 | 155 | --unprepared; |
| 156 | 156 | } |
| 157 | 157 | } catch (Xapian::Error & e) { |
| 158 | | if (!errorhandler) throw; |
| | 158 | //TODO:add test coverage |
| | 159 | Xapian::ErrorHandler* errorhandler_ = db.internal[leaf]->error_handler; |
| | 160 | if (!errorhandler_) throw; |
| 159 | 161 | |
| 160 | 162 | LOGLINE(EXCEPTION, "Calling error handler for prepare_match() on a SubMatch."); |
| 161 | | (*errorhandler)(e); |
| | 163 | (*errorhandler_)(e); |
| 162 | 164 | // Continue match without this sub-match. |
| 163 | 165 | leaves[leaf] = NULL; |
| 164 | 166 | prepared[leaf] = true; |
| … |
… |
MultiMatch::MultiMatch(const Xapian::Database &db_,
|
| 211 | 213 | Xapian::valueno sort_key_, |
| 212 | 214 | Xapian::Enquire::Internal::sort_setting sort_by_, |
| 213 | 215 | bool sort_value_forward_, |
| 214 | | Xapian::ErrorHandler * errorhandler_, |
| 215 | 216 | Xapian::Weight::Internal & stats, |
| 216 | 217 | const Xapian::Weight * weight_, |
| 217 | 218 | const vector<Xapian::MatchSpy *> & matchspies_, |
| … |
… |
MultiMatch::MultiMatch(const Xapian::Database &db_,
|
| 222 | 223 | order(order_), |
| 223 | 224 | sort_key(sort_key_), sort_by(sort_by_), |
| 224 | 225 | sort_value_forward(sort_value_forward_), |
| 225 | | errorhandler(errorhandler_), weight(weight_), |
| | 226 | weight(weight_), |
| 226 | 227 | is_remote(db.internal.size()), |
| 227 | 228 | matchspies(matchspies_) |
| 228 | 229 | { |
| 229 | | LOGCALL_CTOR(MATCH, "MultiMatch", db_ | query_ | qlen | omrset | collapse_max_ | collapse_key_ | percent_cutoff_ | weight_cutoff_ | int(order_) | sort_key_ | int(sort_by_) | sort_value_forward_ | errorhandler_ | stats | weight_ | matchspies_ | have_sorter | have_mdecider); |
| | 230 | LOGCALL_CTOR(MATCH, "MultiMatch", db_ | query_ | qlen | omrset | collapse_max_ | collapse_key_ | percent_cutoff_ | weight_cutoff_ | int(order_) | sort_key_ | int(sort_by_) | sort_value_forward_ | stats | weight_ | matchspies_ | have_sorter | have_mdecider); |
| 230 | 231 | |
| 231 | 232 | if (query.empty()) return; |
| 232 | 233 | |
| … |
… |
MultiMatch::MultiMatch(const Xapian::Database &db_,
|
| 267 | 268 | smatch = new LocalSubMatch(subdb, query, qlen, subrsets[i], weight); |
| 268 | 269 | #endif /* XAPIAN_HAS_REMOTE_BACKEND */ |
| 269 | 270 | } catch (Xapian::Error & e) { |
| 270 | | if (!errorhandler) throw; |
| | 271 | Xapian::ErrorHandler* errorhandler_ = subdb->error_handler; |
| | 272 | if (!errorhandler_) throw; |
| 271 | 273 | LOGLINE(EXCEPTION, "Calling error handler for creation of a SubMatch from a database and query."); |
| 272 | | (*errorhandler)(e); |
| | 274 | (*errorhandler_)(e); |
| 273 | 275 | // Continue match without this sub-postlist. |
| 274 | 276 | smatch = NULL; |
| 275 | 277 | } |
| … |
… |
MultiMatch::MultiMatch(const Xapian::Database &db_,
|
| 277 | 279 | } |
| 278 | 280 | |
| 279 | 281 | stats.mark_wanted_terms(query); |
| 280 | | prepare_sub_matches(leaves, errorhandler, stats); |
| | 282 | prepare_sub_matches(leaves, stats, db); |
| 281 | 283 | stats.set_bounds_from_db(db); |
| 282 | 284 | } |
| 283 | 285 | |
| … |
… |
MultiMatch::get_mset(Xapian::doccount first, Xapian::doccount maxitems,
|
| 333 | 335 | // Start matchers. |
| 334 | 336 | { |
| 335 | 337 | vector<intrusive_ptr<SubMatch> >::iterator leaf; |
| 336 | | for (leaf = leaves.begin(); leaf != leaves.end(); ++leaf) { |
| 337 | | if (!(*leaf).get()) continue; |
| | 338 | for (size_t i = 0; i < leaves.size(); ++i) { |
| | 339 | if (!(leaves[i]).get()) continue; |
| 338 | 340 | try { |
| 339 | | (*leaf)->start_match(0, first + maxitems, |
| | 341 | (leaves[i])->start_match(0, first + maxitems, |
| 340 | 342 | first + check_at_least, stats); |
| 341 | 343 | } catch (Xapian::Error & e) { |
| 342 | | if (!errorhandler) throw; |
| | 344 | //TODO: add test coverage |
| | 345 | Xapian::ErrorHandler* errorhandler_ = db.internal[i]->error_handler; |
| | 346 | if (!errorhandler_) throw; |
| 343 | 347 | LOGLINE(EXCEPTION, "Calling error handler for " |
| 344 | 348 | "start_match() on a SubMatch."); |
| 345 | | (*errorhandler)(e); |
| | 349 | (*errorhandler_)(e); |
| 346 | 350 | // Continue match without this sub-match. |
| 347 | | *leaf = NULL; |
| | 351 | leaves[i] = NULL; |
| 348 | 352 | } |
| 349 | 353 | } |
| 350 | 354 | } |
| … |
… |
MultiMatch::get_mset(Xapian::doccount first, Xapian::doccount maxitems,
|
| 364 | 368 | for (size_t i = 0; i != leaves.size(); ++i) { |
| 365 | 369 | PostList *pl; |
| 366 | 370 | try { |
| | 371 | if (!leaves[i].get()) { |
| | 372 | pl = new EmptyPostList; |
| | 373 | postlists.push_back(pl); |
| | 374 | continue; |
| | 375 | } |
| 367 | 376 | pl = leaves[i]->get_postlist_and_term_info(this, |
| 368 | 377 | termfreqandwts_ptr, |
| 369 | 378 | &total_subqs); |
| … |
… |
MultiMatch::get_mset(Xapian::doccount first, Xapian::doccount maxitems,
|
| 380 | 389 | } |
| 381 | 390 | } |
| 382 | 391 | } catch (Xapian::Error & e) { |
| 383 | | if (!errorhandler) throw; |
| | 392 | //TODO: add test coverage |
| | 393 | Xapian::ErrorHandler* errorhandler_ = db.internal[i]->error_handler; |
| | 394 | if (!errorhandler_) throw; |
| 384 | 395 | LOGLINE(EXCEPTION, "Calling error handler for " |
| 385 | 396 | "get_term_info() on a SubMatch."); |
| 386 | | (*errorhandler)(e); |
| | 397 | (*errorhandler_)(e); |
| 387 | 398 | // FIXME: check if *ALL* the remote servers have failed! |
| 388 | 399 | // Continue match without this sub-match. |
| 389 | 400 | leaves[i] = NULL; |
| … |
… |
MultiMatch::get_mset(Xapian::doccount first, Xapian::doccount maxitems,
|
| 396 | 407 | ValueStreamDocument vsdoc(db); |
| 397 | 408 | ++vsdoc._refs; |
| 398 | 409 | Xapian::Document doc(&vsdoc); |
| | 410 | vector<Xapian::ErrorHandler*>handlers; |
| 399 | 411 | |
| | 412 | Xapian::doccount number_of_subdbs = db.internal.size(); |
| | 413 | for (size_t i = 0; i != number_of_subdbs; ++i) { |
| | 414 | Xapian::Database::Internal *subdb = db.internal[i].get(); |
| | 415 | Assert(subdb); |
| | 416 | handlers.push_back(subdb->error_handler); |
| | 417 | } |
| 400 | 418 | // Get a single combined postlist |
| 401 | 419 | AutoPtr<PostList> pl; |
| 402 | 420 | if (postlists.size() == 1) { |
| 403 | 421 | pl.reset(postlists.front()); |
| 404 | 422 | } else { |
| 405 | | pl.reset(new MergePostList(postlists, this, vsdoc, errorhandler)); |
| | 423 | pl.reset(new MergePostList(postlists, this, vsdoc, handlers)); |
| 406 | 424 | } |
| 407 | 425 | |
| 408 | 426 | LOGLINE(MATCH, "pl = (" << pl->get_description() << ")"); |
diff --git a/xapian-core/matcher/multimatch.h b/xapian-core/matcher/multimatch.h
index d2ec377..6a9facc 100644
|
a
|
b
|
class MultiMatch
|
| 57 | 57 | |
| 58 | 58 | bool sort_value_forward; |
| 59 | 59 | |
| 60 | | /// ErrorHandler |
| 61 | | Xapian::ErrorHandler * errorhandler; |
| 62 | | |
| 63 | 60 | /// Weighting scheme |
| 64 | 61 | const Xapian::Weight * weight; |
| 65 | 62 | |
| … |
… |
class MultiMatch
|
| 93 | 90 | * @param query The query |
| 94 | 91 | * @param qlen The query length |
| 95 | 92 | * @param omrset The relevance set (or NULL for no RSet) |
| 96 | | * @param errorhandler Errorhandler object |
| 97 | 93 | * @param stats The stats object to add our stats to. |
| 98 | 94 | * @param wtscheme Weighting scheme |
| 99 | 95 | * @param matchspies_ Any the MatchSpy objects in use. |
| … |
… |
class MultiMatch
|
| 112 | 108 | Xapian::valueno sort_key_, |
| 113 | 109 | Xapian::Enquire::Internal::sort_setting sort_by_, |
| 114 | 110 | bool sort_value_forward_, |
| 115 | | Xapian::ErrorHandler * errorhandler, |
| 116 | 111 | Xapian::Weight::Internal & stats, |
| 117 | 112 | const Xapian::Weight *wtscheme, |
| 118 | 113 | const vector<Xapian::MatchSpy *> & matchspies_, |
diff --git a/xapian-core/net/remoteserver.cc b/xapian-core/net/remoteserver.cc
index b741fc6..f283727 100644
|
a
|
b
|
RemoteServer::msg_query(const string &message_in)
|
| 459 | 459 | Xapian::Weight::Internal local_stats; |
| 460 | 460 | MultiMatch match(*db, query, qlen, &rset, collapse_max, collapse_key, |
| 461 | 461 | percent_cutoff, weight_cutoff, order, |
| 462 | | sort_key, sort_by, sort_value_forward, NULL, |
| | 462 | sort_key, sort_by, sort_value_forward, |
| 463 | 463 | local_stats, wt.get(), matchspies.spies, false, false); |
| 464 | 464 | |
| 465 | 465 | send_message(REPLY_STATS, serialise_stats(local_stats)); |
diff --git a/xapian-core/tests/api_db.cc b/xapian-core/tests/api_db.cc
index 0fd1e70..6993a57 100644
|
a
|
b
|
DEFINE_TESTCASE(stubdb6, inmemory) {
|
| 226 | 226 | return true; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | | #if 0 // the "force error" mechanism is no longer in place... |
| | 229 | |
| 230 | 230 | class MyErrorHandler : public Xapian::ErrorHandler { |
| 231 | 231 | public: |
| 232 | 232 | int count; |
| … |
… |
class MyErrorHandler : public Xapian::ErrorHandler {
|
| 241 | 241 | MyErrorHandler() : count (0) {} |
| 242 | 242 | }; |
| 243 | 243 | |
| | 244 | DEFINE_TESTCASE(errorhandlercalled, remote && !multi) { |
| | 245 | MyErrorHandler myhandler; |
| | 246 | BackendManagerLocal local_manager; |
| | 247 | Xapian::Database dbs; |
| | 248 | |
| | 249 | dbs.add_database(get_remote_database("apitest_simpledata", 5000)); |
| | 250 | dbs.add_database(local_manager.get_database("apitest_simpledata")); |
| | 251 | |
| | 252 | dbs.set_error_handler(&myhandler); |
| | 253 | Xapian::Enquire enquire(dbs); |
| | 254 | |
| | 255 | enquire.set_query(Xapian::Query("word")); |
| | 256 | Xapian::MultiValueKeyMaker sorter; |
| | 257 | |
| | 258 | enquire.set_sort_by_key_then_relevance(&sorter, true); |
| | 259 | Xapian::MSet mset = enquire.get_mset(0, 25); |
| | 260 | TEST_EQUAL(myhandler.count, 1); |
| | 261 | TEST_EQUAL(mset.size(), 2); |
| | 262 | return true; |
| | 263 | } |
| | 264 | |
| | 265 | #if 0 // the "force error" mechanism is no longer in place... |
| 244 | 266 | // tests error handler in multimatch(). |
| 245 | 267 | DEFINE_TESTCASE(multierrhandler1, backend) { |
| 246 | 268 | MyErrorHandler myhandler; |
| 247 | 269 | |
| 248 | 270 | Xapian::Database mydb2(get_database("apitest_simpledata")); |
| 249 | 271 | Xapian::Database mydb3(get_database("apitest_simpledata2")); |
| | 272 | |
| 250 | 273 | int errcount = 1; |
| 251 | 274 | for (int testcount = 0; testcount < 14; testcount ++) { |
| 252 | 275 | tout << "testcount=" << testcount << "\n"; |
| … |
… |
DEFINE_TESTCASE(multierrhandler1, backend) {
|
| 332 | 355 | break; |
| 333 | 356 | } |
| 334 | 357 | tout << "db=" << dbs << "\n"; |
| 335 | | Xapian::Enquire enquire(dbs, &myhandler); |
| | 358 | dbs.set_error_handler(myhandler); |
| | 359 | Xapian::Enquire enquire(dbs); |
| 336 | 360 | |
| 337 | 361 | // make a query |
| 338 | 362 | Xapian::Query myquery = query(Xapian::Query::OP_OR, "inmemory", "word"); |