summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-02-03 01:15:13 +0100
committerTor Egge <Tor.Egge@online.no>2023-02-03 01:15:13 +0100
commita6290006e02fc3e0f5902e424d9150059e9565bc (patch)
tree6106cc56d173d589cba84361a50ab705cd3d0ad2 /searchcore
parent2e9c8e2454186b93a6ef11ace4da67d1144e752e (diff)
Use copy of ranking assets repo in matchers.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/ranking_assets_repo.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp3
4 files changed, 12 insertions, 8 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/ranking_assets_repo.h b/searchcore/src/vespa/searchcore/proton/matching/ranking_assets_repo.h
index d0440f7be90..37d814fc8d3 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/ranking_assets_repo.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/ranking_assets_repo.h
@@ -21,9 +21,9 @@ private:
using ConstantValueFactory = vespalib::eval::ConstantValueFactory;
const ConstantValueFactory &_factory;
- RankingConstants::SP _constants;
- RankingExpressions::SP _rankingExpressions;
- OnnxModels::SP _onnxModels;
+ std::shared_ptr<const RankingConstants> _constants;
+ std::shared_ptr<const RankingExpressions> _rankingExpressions;
+ std::shared_ptr<const OnnxModels> _onnxModels;
public:
explicit RankingAssetsRepo(const ConstantValueFactory &factory);
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
index 6a455fb71c0..0586451ec98 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
@@ -18,10 +18,11 @@ using namespace vespalib::make_string_short;
Matchers::Matchers(const vespalib::Clock &clock,
matching::QueryLimiter &queryLimiter,
- const matching::IRankingAssetsRepo &rankingAssetsRepo)
+ const matching::RankingAssetsRepo &rankingAssetsRepo)
: _rpmap(),
+ _ranking_assets_repo(rankingAssetsRepo),
_fallback(std::make_shared<Matcher>(search::index::Schema(), search::fef::Properties(), clock, queryLimiter,
- rankingAssetsRepo, -1)),
+ _ranking_assets_repo, -1)),
_default()
{ }
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.h b/searchcore/src/vespa/searchcore/proton/server/matchers.h
index 72057a49935..94a84faa7d6 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.h
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.h
@@ -3,6 +3,7 @@
#pragma once
#include <vespa/searchcore/proton/matching/matching_stats.h>
+#include <vespa/searchcore/proton/matching/ranking_assets_repo.h>
#include <vespa/vespalib/stllike/hash_map.h>
namespace vespalib { class Clock; }
@@ -12,20 +13,20 @@ namespace proton {
namespace matching {
class Matcher;
class QueryLimiter;
- struct IRankingAssetsRepo;
}
class Matchers {
private:
using Map = vespalib::hash_map<vespalib::string, std::shared_ptr<matching::Matcher>>;
Map _rpmap;
+ const matching::RankingAssetsRepo _ranking_assets_repo;
std::shared_ptr<matching::Matcher> _fallback;
std::shared_ptr<matching::Matcher> _default;
public:
using SP = std::shared_ptr<Matchers>;
Matchers(const vespalib::Clock &clock,
matching::QueryLimiter &queryLimiter,
- const matching::IRankingAssetsRepo &rankingAssetsRepo);
+ const matching::RankingAssetsRepo &rankingAssetsRepo);
Matchers(const Matchers &) = delete;
Matchers & operator =(const Matchers &) = delete;
~Matchers();
@@ -33,6 +34,7 @@ public:
matching::MatchingStats getStats() const;
matching::MatchingStats getStats(const vespalib::string &name) const;
std::shared_ptr<matching::Matcher> lookup(const vespalib::string &name) const;
+ const matching::RankingAssetsRepo& get_ranking_assets_repo() const noexcept { return _ranking_assets_repo; }
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
index 6a34e3ac53e..68233419e74 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
@@ -111,6 +111,7 @@ SearchableDocSubDBConfigurer::createMatchers(const Schema::SP &schema,
const RankProfilesConfig &cfg)
{
auto newMatchers = std::make_shared<Matchers>(_clock, _queryLimiter, _rankingAssetsRepo);
+ auto& ranking_assets_repo = newMatchers->get_ranking_assets_repo();
for (const auto &profile : cfg.rankprofile) {
vespalib::string name = profile.name;
search::fef::Properties properties;
@@ -119,7 +120,7 @@ SearchableDocSubDBConfigurer::createMatchers(const Schema::SP &schema,
}
// schema instance only used during call.
auto profptr = std::make_shared<Matcher>(*schema, std::move(properties), _clock, _queryLimiter,
- _rankingAssetsRepo, _distributionKey);
+ ranking_assets_repo, _distributionKey);
newMatchers->add(name, std::move(profptr));
}
return newMatchers;