// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "matchers.h" #include #include #include #include namespace searchcorespi { class IndexSearchable; } namespace proton::matching { class MatchContext; class Matcher; class SessionManager; } namespace proton { struct IAttributeManager; class MatchView { using SessionManager = matching::SessionManager; std::shared_ptr _matchers; std::shared_ptr _indexSearchable; std::shared_ptr _attrMgr; SessionManager & _sessionMgr; std::shared_ptr _metaStore; DocIdLimit &_docIdLimit; size_t getNumDocs() const { return _metaStore->get().getNumActiveLids(); } public: using SP = std::shared_ptr; MatchView(const MatchView &) = delete; MatchView & operator = (const MatchView &) = delete; MatchView(std::shared_ptr matchers, std::shared_ptr indexSearchable, std::shared_ptr attrMgr, SessionManager & sessionMgr, std::shared_ptr metaStore, DocIdLimit &docIdLimit); ~MatchView(); const std::shared_ptr& getMatchers() const noexcept { return _matchers; } const std::shared_ptr& getIndexSearchable() const noexcept { return _indexSearchable; } const std::shared_ptr& getAttributeManager() const noexcept { return _attrMgr; } SessionManager & getSessionManager() const noexcept { return _sessionMgr; } const std::shared_ptr& getDocumentMetaStore() const noexcept { return _metaStore; } DocIdLimit & getDocIdLimit() const noexcept { return _docIdLimit; } // Throws on error. std::shared_ptr getMatcher(const vespalib::string & rankProfile) const; matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const { return _matchers->getStats(rankProfile); } matching::MatchContext createContext() const; std::unique_ptr match(std::shared_ptr searchHandler, const search::engine::SearchRequest &req, vespalib::ThreadBundle &threadBundle) const; }; } // namespace proton