aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-04-21 08:13:40 +0200
committerGitHub <noreply@github.com>2022-04-21 08:13:40 +0200
commita034956b4a9fedf384a60c1703729e338b9c2f8f (patch)
tree7d32d54d6747a28bde785132873c26d973ced3cc /searchcore
parentbfe6aa698c0f58dd761349c281b51aabc0edafff (diff)
Revert "Revert "Report incorrect rank-profile." MERGEOK"
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.cpp34
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.cpp8
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 cbe697fa426..e8c3ac885ea 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -763,14 +763,8 @@ 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());
- 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;
- }
+ return view->match(req, threadBundle);
}
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 62ae7774daf..809f2e0a744 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
@@ -4,26 +4,31 @@
#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(new matching::Matcher(search::index::Schema(), search::fef::Properties(),
- clock, queryLimiter, constantValueRepo, RankingExpressions(), OnnxModels(), -1)),
+ _fallback(std::make_shared<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<matching::Matcher> matcher)
+Matchers::add(const vespalib::string &name, std::shared_ptr<Matcher> matcher)
{
if ((name == "default") || ! _default) {
_default = matcher;
@@ -31,30 +36,37 @@ Matchers::add(const vespalib::string &name, std::shared_ptr<matching::Matcher> m
_rpmap[name] = std::move(matcher);
}
-matching::MatchingStats
+MatchingStats
Matchers::getStats() const
{
- matching::MatchingStats stats;
+ MatchingStats stats;
for (const auto & entry : _rpmap) {
stats.add(entry.second->getStats());
}
return stats;
}
-matching::MatchingStats
+MatchingStats
Matchers::getStats(const vespalib::string &name) const
{
auto it = _rpmap.find(name);
- return it != _rpmap.end() ? it->second->getStats() :
- matching::MatchingStats();
+ return it != _rpmap.end() ? it->second->getStats() : MatchingStats();
}
-matching::Matcher::SP
+std::shared_ptr<Matcher>
Matchers::lookup(const vespalib::string &name) const
{
Map::const_iterator found(_rpmap.find(name));
- return (found != _rpmap.end()) ? found->second : _default;
- //TODO add warning log message when not found, may want to use "_fallback" in most cases here
+ 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;
}
vespalib::string
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
index 210de685472..768e2c80b62 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
@@ -52,13 +52,7 @@ MatchView::~MatchView() = default;
Matcher::SP
MatchView::getMatcher(const vespalib::string & rankProfile) const
{
- 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;
+ return _matchers->lookup(rankProfile);
}
MatchContext::UP