diff options
author | Arnstein Ressem <aressem@gmail.com> | 2022-04-21 08:04:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 08:04:29 +0200 |
commit | 1f2379d4e0eecfb6a128434f72fc400c72efcfa1 (patch) | |
tree | c52e6ab8fa8bae4cd93cfb122233894cb2f2afad /searchcore | |
parent | 332014a69d84d7949a1c8a2c351882a242331fc4 (diff) |
Revert "Report incorrect rank-profile."
Diffstat (limited to 'searchcore')
3 files changed, 25 insertions, 25 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index e8c3ac885ea..cbe697fa426 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -763,8 +763,14 @@ DocumentDB::getNewestFlushedSerial() std::unique_ptr<SearchReply> DocumentDB::match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const { + // Ignore input searchhandler. Use readysubdb's searchhandler instead. ISearchHandler::SP view(_subDBs.getReadySubDB()->getSearchView()); - return view->match(req, threadBundle); + try { + return view->match(req, threadBundle); + } catch (const std::exception & e) { + LOG(warning, "match failed for document type '%s' with exception: %s", getName().c_str(), e.what()); + throw e; + } } std::unique_ptr<DocsumReply> diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp index 809f2e0a744..62ae7774daf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp @@ -4,31 +4,26 @@ #include <vespa/searchcore/proton/matching/matcher.h> #include <vespa/searchcore/proton/matching/ranking_expressions.h> #include <vespa/searchcore/proton/matching/onnx_models.h> -#include <vespa/vespalib/util/issue.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/stllike/hash_map.hpp> namespace proton { using matching::RankingExpressions; using matching::OnnxModels; -using matching::Matcher; -using matching::MatchingStats; -using namespace vespalib::make_string_short; Matchers::Matchers(const vespalib::Clock &clock, matching::QueryLimiter &queryLimiter, const matching::IConstantValueRepo &constantValueRepo) : _rpmap(), - _fallback(std::make_shared<Matcher>(search::index::Schema(), search::fef::Properties(), clock, queryLimiter, - constantValueRepo, RankingExpressions(), OnnxModels(), -1)), + _fallback(new matching::Matcher(search::index::Schema(), search::fef::Properties(), + clock, queryLimiter, constantValueRepo, RankingExpressions(), OnnxModels(), -1)), _default() { } Matchers::~Matchers() = default; void -Matchers::add(const vespalib::string &name, std::shared_ptr<Matcher> matcher) +Matchers::add(const vespalib::string &name, std::shared_ptr<matching::Matcher> matcher) { if ((name == "default") || ! _default) { _default = matcher; @@ -36,37 +31,30 @@ Matchers::add(const vespalib::string &name, std::shared_ptr<Matcher> matcher) _rpmap[name] = std::move(matcher); } -MatchingStats +matching::MatchingStats Matchers::getStats() const { - MatchingStats stats; + matching::MatchingStats stats; for (const auto & entry : _rpmap) { stats.add(entry.second->getStats()); } return stats; } -MatchingStats +matching::MatchingStats Matchers::getStats(const vespalib::string &name) const { auto it = _rpmap.find(name); - return it != _rpmap.end() ? it->second->getStats() : MatchingStats(); + return it != _rpmap.end() ? it->second->getStats() : + matching::MatchingStats(); } -std::shared_ptr<Matcher> +matching::Matcher::SP Matchers::lookup(const vespalib::string &name) const { Map::const_iterator found(_rpmap.find(name)); - if (found == _rpmap.end()) { - if (_default) { - vespalib::Issue::report(fmt("Failed to find rank-profile '%s'. Falling back to 'default'", name.c_str())); - return _default; - } else { - vespalib::Issue::report(fmt("Failed to find rank-profile '%s'. Most likely a configuration issue.", name.c_str())); - return _fallback; - } - } - return found->second; + return (found != _rpmap.end()) ? found->second : _default; + //TODO add warning log message when not found, may want to use "_fallback" in most cases here } vespalib::string diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp index 768e2c80b62..210de685472 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp @@ -52,7 +52,13 @@ MatchView::~MatchView() = default; Matcher::SP MatchView::getMatcher(const vespalib::string & rankProfile) const { - return _matchers->lookup(rankProfile); + Matcher::SP retval = _matchers->lookup(rankProfile); + if ( ! retval) { + throw IllegalArgumentException(fmt("Failed locating Matcher for rank profile '%s' docIdLimit=%d num_matchers=%d matchers='%s'", + rankProfile.c_str(), _docIdLimit.get(), _matchers->numMatchers(), _matchers->listMatchers().c_str()), VESPA_STRLOC); + } + LOG(debug, "Rankprofile = %s has termwise_limit=%f", rankProfile.c_str(), retval->get_termwise_limit()); + return retval; } MatchContext::UP |