diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-03-30 10:52:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 10:52:22 +0200 |
commit | d77fc0fcf1fb69f935333af0e36605ec9113758a (patch) | |
tree | 53aa1e3065a1aaf9aa18be3f98830d88b5181ebc /searchcore | |
parent | 211fdb61ecf7379c8113e0da413a8cc16f72494d (diff) | |
parent | ddbbf02d0598cd0dbd31bb71c57c7f0f2293f597 (diff) |
Merge pull request #21884 from vespa-engine/toregge/move-searchcontext-out-from-attributevector
Move SearchContext out from AttributeVector.
Diffstat (limited to 'searchcore')
5 files changed, 9 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index c96b0825789..0414990d74e 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -41,6 +41,7 @@ using search::GrowStrategy; using search::LidUsageStats; using search::QueryTermSimple; using search::TuneFileAttributes; +using search::attribute::SearchContext; using search::attribute::SearchContextParams; using search::fef::MatchData; using search::fef::MatchDataLayout; @@ -197,7 +198,7 @@ assertSearchResult(const SimpleResult &exp, const DocumentMetaStore &dms, const vespalib::string &term, const QueryTermSimple::Type &termType, bool strict, uint32_t docIdLimit = 100) { - AttributeVector::SearchContext::UP sc = + std::unique_ptr<SearchContext> sc = dms.getSearch(std::make_unique<QueryTermSimple>(term, termType), SearchContextParams()); TermFieldMatchData tfmd; SearchIterator::UP sb = sc->createIterator(&tfmd, strict); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index 75cb8dfa6b3..e289b71a447 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -40,6 +40,7 @@ using search::GrowStrategy; using search::IAttributeSaveTarget; using search::LidUsageStats; using search::attribute::LoadUtils; +using search::attribute::SearchContext; using search::attribute::SearchContextParams; using search::fef::TermFieldMatchData; using search::queryeval::Blueprint; @@ -798,7 +799,7 @@ DocumentMetaStore::createWhiteListBlueprint() const return _lidAlloc.createWhiteListBlueprint(); } -AttributeVector::SearchContext::UP +std::unique_ptr<SearchContext> DocumentMetaStore::getSearch(std::unique_ptr<search::QueryTermSimple> qTerm, const SearchContextParams &) const { return std::make_unique<documentmetastore::SearchContext>(std::move(qTerm), *this); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 87176721681..b5a95b8cd34 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -202,7 +202,7 @@ public: /** * Implements search::AttributeVector */ - SearchContext::UP + std::unique_ptr<search::attribute::SearchContext> getSearch(std::unique_ptr<search::QueryTermSimple> qTerm, const search::attribute::SearchContextParams ¶ms) const override; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp index 34766071af1..ea815d102f7 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp @@ -115,7 +115,7 @@ SearchContext::onFind(DocId, int32_t ) const unsigned int SearchContext::approximateHits() const { - return _isWord ? 1 : search::AttributeVector::SearchContext::approximateHits(); + return _isWord ? 1 : search::attribute::SearchContext::approximateHits(); } SearchIterator::UP @@ -135,7 +135,7 @@ SearchContext::getStore() const } SearchContext::SearchContext(QueryTermSimple::UP qTerm, const DocumentMetaStore &toBeSearched) - : search::AttributeVector::SearchContext(toBeSearched), + : search::attribute::SearchContext(toBeSearched), _isWord(qTerm->isWord()) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h index 3b26c899cba..a2a265ad519 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h @@ -4,6 +4,7 @@ #include <vespa/document/base/globalid.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <vespa/searchlib/attribute/search_context.h> #include "documentmetastore.h" namespace proton::documentmetastore { @@ -11,7 +12,7 @@ namespace proton::documentmetastore { /** * Search context used to search the document meta store for all valid documents. */ -class SearchContext : public search::AttributeVector::SearchContext +class SearchContext : public search::attribute::SearchContext { private: using DocId = search::AttributeVector::DocId; |