blob: 81de92a406a884526b45cb0e4f15658a0a8ba8df (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchcore/proton/matching/matching_stats.h>
#include <vespa/searchlib/fef/ranking_assets_repo.h>
#include <vespa/vespalib/stllike/hash_map.h>
namespace vespalib { class Clock; }
namespace proton {
namespace matching {
class Matcher;
class QueryLimiter;
}
class Matchers {
private:
using Map = vespalib::hash_map<vespalib::string, std::shared_ptr<matching::Matcher>>;
Map _rpmap;
const search::fef::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 search::fef::RankingAssetsRepo &rankingAssetsRepo);
Matchers(const Matchers &) = delete;
Matchers & operator =(const Matchers &) = delete;
~Matchers();
void add(const vespalib::string &name, std::shared_ptr<matching::Matcher> matcher);
matching::MatchingStats getStats() const;
matching::MatchingStats getStats(const vespalib::string &name) const;
std::shared_ptr<matching::Matcher> lookup(const vespalib::string &name) const;
const search::fef::RankingAssetsRepo& get_ranking_assets_repo() const noexcept { return _ranking_assets_repo; }
};
} // namespace proton
|