aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-27 11:08:29 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-27 11:16:36 +0000
commit0a1cf3297b396688938d1d06d2df4fa3af38ae5c (patch)
treec5db5b223c98d4393382e1401cf5341e6dd28867 /searchcore
parent84449baedc77f82034c1c2ff404e6636e7b9f90f (diff)
Reduce code visibility and minor cleanup.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp11
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp3
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp19
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_params.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_params.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h9
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h16
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.h22
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchview.cpp4
24 files changed, 141 insertions, 84 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index 7db4b6fc9dd..637ce90c72e 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -22,6 +22,7 @@
#include <vespa/searchcore/proton/server/memoryconfigstore.h>
#include <vespa/searchcore/proton/server/searchview.h>
#include <vespa/searchcore/proton/server/summaryadapter.h>
+#include <vespa/searchcore/proton/matching/querylimiter.h>
#include <vespa/searchlib/common/gatecallback.h>
#include <vespa/searchlib/engine/docsumapi.h>
#include <vespa/searchlib/index/docbuilder.h>
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 3154b420789..069541eea91 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -7,19 +7,18 @@
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/docsummary/summarymanager.h>
-#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h>
#include <vespa/searchcore/proton/documentmetastore/lidreusedelayer.h>
#include <vespa/searchcore/proton/index/index_writer.h>
#include <vespa/searchcore/proton/index/indexmanager.h>
#include <vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h>
-#include <vespa/searchcore/proton/server/attribute_writer_factory.h>
-#include <vespa/searchcore/proton/server/documentdbconfigmanager.h>
#include <vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h>
#include <vespa/searchcore/proton/server/executorthreadingservice.h>
#include <vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h>
#include <vespa/searchcore/proton/server/summaryadapter.h>
+#include <vespa/searchcore/proton/server/attribute_writer_factory.h>
#include <vespa/searchcore/proton/server/reconfig_params.h>
#include <vespa/searchcore/proton/matching/sessionmanager.h>
+#include <vespa/searchcore/proton/matching/querylimiter.h>
#include <vespa/searchcore/proton/test/documentdb_config_builder.h>
#include <vespa/searchcore/proton/test/mock_summary_adapter.h>
#include <vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h>
@@ -133,10 +132,10 @@ ViewSet::ViewSet()
feedView(),
_hwInfo()
{ }
-ViewSet::~ViewSet() {}
+ViewSet::~ViewSet() = default;
struct EmptyConstantValueFactory : public vespalib::eval::ConstantValueFactory {
- virtual vespalib::eval::ConstantValue::UP create(const vespalib::string &, const vespalib::string &) const override {
+ vespalib::eval::ConstantValue::UP create(const vespalib::string &, const vespalib::string &) const override {
return vespalib::eval::ConstantValue::UP(nullptr);
}
};
@@ -294,7 +293,7 @@ struct FastAccessFixture
: _sharedExecutor(1, 0x10000),
_writeService(_sharedExecutor),
_view(_writeService),
- _configurer(_view._feedView, IAttributeWriterFactory::UP(new AttributeWriterFactory), "test")
+ _configurer(_view._feedView, std::make_unique<AttributeWriterFactory>(), "test")
{
vespalib::rmdir(BASE_DIR, true);
vespalib::mkdir(BASE_DIR);
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index c26bb975a7a..7dca5493b15 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/searchcore/proton/server/i_document_subdb_owner.h>
#include <vespa/searchcore/proton/server/minimal_document_retriever.h>
#include <vespa/searchcore/proton/server/searchabledocsubdb.h>
+#include <vespa/searchcore/proton/matching/querylimiter.h>
#include <vespa/searchcore/proton/test/test.h>
#include <vespa/searchcore/proton/test/thread_utils.h>
#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h>
@@ -31,8 +32,6 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/lambdatask.h>
-#include <iostream>
-
using namespace cloud::config::filedistribution;
using namespace document;
using namespace proton::matching;
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 83d520ea69b..88705e73bc5 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -24,6 +24,7 @@
#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/searchlib/test/mock_attribute_context.h>
#include <vespa/searchlib/fef/properties.h>
+#include <vespa/searchlib/fef/indexproperties.h>
#include <vespa/searchlib/query/tree/querybuilder.h>
#include <vespa/searchlib/query/tree/stackdumpcreator.h>
#include <vespa/searchlib/queryeval/isourceselector.h>
@@ -159,7 +160,7 @@ struct MyWorld {
// attribute context
{
SingleInt32ExtAttribute *attr = new SingleInt32ExtAttribute("a1");
- AttributeVector::DocId docid;
+ AttributeVector::DocId docid(0);
for (uint32_t i = 0; i < NUM_DOCS; ++i) {
attr->addDoc(docid);
attr->add(i, docid); // value = docid
@@ -169,7 +170,7 @@ struct MyWorld {
}
{
SingleInt32ExtAttribute *attr = new SingleInt32ExtAttribute("a2");
- AttributeVector::DocId docid;
+ AttributeVector::DocId docid(0);
for (uint32_t i = 0; i < NUM_DOCS; ++i) {
attr->addDoc(docid);
attr->add(i * 2, docid); // value = docid * 2
@@ -179,7 +180,7 @@ struct MyWorld {
}
{
SingleInt32ExtAttribute *attr = new SingleInt32ExtAttribute("a3");
- AttributeVector::DocId docid;
+ AttributeVector::DocId docid(0);
for (uint32_t i = 0; i < NUM_DOCS; ++i) {
attr->addDoc(docid);
attr->add(i%10, docid);
@@ -253,11 +254,11 @@ struct MyWorld {
.doc(600).doc(700).doc(800).doc(900));
}
- void setStackDump(Request &request, const vespalib::string &stack_dump) {
+ static void setStackDump(Request &request, const vespalib::string &stack_dump) {
request.stackDump.assign(stack_dump.data(), stack_dump.data() + stack_dump.size());
}
- SearchRequest::SP createRequest(const vespalib::string &stack_dump)
+ static SearchRequest::SP createRequest(const vespalib::string &stack_dump)
{
SearchRequest::SP request(new SearchRequest);
request->setTimeout(60 * fastos::TimeStamp::SEC);
@@ -266,12 +267,12 @@ struct MyWorld {
return request;
}
- SearchRequest::SP createSimpleRequest(const vespalib::string &field, const vespalib::string &term)
+ static SearchRequest::SP createSimpleRequest(const vespalib::string &field, const vespalib::string &term)
{
return createRequest(make_simple_stack_dump(field, term));
}
- SearchRequest::SP createSameElementRequest(const vespalib::string &a1_term, const vespalib::string &f1_term)
+ static SearchRequest::SP createSameElementRequest(const vespalib::string &a1_term, const vespalib::string &f1_term)
{
return createRequest(make_same_element_stack_dump(a1_term, f1_term));
}
@@ -325,7 +326,7 @@ struct MyWorld {
return reply;
}
- DocsumRequest::UP create_docsum_request(const vespalib::string &stack_dump, const std::initializer_list<uint32_t> docs) {
+ static DocsumRequest::UP create_docsum_request(const vespalib::string &stack_dump, const std::initializer_list<uint32_t> docs) {
auto req = std::make_unique<DocsumRequest>();
setStackDump(*req, stack_dump);
for (uint32_t docid: docs) {
@@ -335,7 +336,7 @@ struct MyWorld {
return req;
}
- DocsumRequest::SP createSimpleDocsumRequest(const vespalib::string & field, const vespalib::string & term) {
+ static DocsumRequest::SP createSimpleDocsumRequest(const vespalib::string & field, const vespalib::string & term) {
// match a subset of basic result + request for a non-hit (not
// sorted on docid)
return create_docsum_request(make_simple_stack_dump(field, term), {30, 10, 15});
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
index cc6b0d952a3..db7fda1c7ef 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
@@ -1,5 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "docsumcontext.h"
+#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/document/datatype/positiondatatype.h>
#include <vespa/searchlib/queryeval/begin_and_end_id.h>
#include <vespa/searchlib/attribute/iattributemanager.h>
@@ -134,7 +135,7 @@ DocsumContext::createSlimeReply()
}
DocsumContext::DocsumContext(const DocsumRequest & request, IDocsumWriter & docsumWriter,
- IDocsumStore & docsumStore, const Matcher::SP & matcher,
+ IDocsumStore & docsumStore, std::shared_ptr<Matcher> matcher,
ISearchContext & searchCtx, IAttributeContext & attrCtx,
IAttributeManager & attrMgr, SessionManager & sessionMgr) :
_request(request),
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h
index 6bd17ba882d..467add7face 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/searchsummary/docsummary/docsumstate.h>
#include <vespa/searchsummary/docsummary/docsumstore.h>
#include <vespa/searchsummary/docsummary/docsumwriter.h>
@@ -10,6 +9,12 @@
namespace proton {
+namespace matching {
+ class Matcher;
+ class ISearchContext;
+ class SessionManager;
+}
+
/**
* The DocsumContext class is responsible for performing a docsum request and
* creating a docsum reply.
@@ -19,7 +24,7 @@ private:
const search::engine::DocsumRequest & _request;
search::docsummary::IDocsumWriter & _docsumWriter;
search::docsummary::IDocsumStore & _docsumStore;
- matching::Matcher::SP _matcher;
+ std::shared_ptr<matching::Matcher> _matcher;
matching::ISearchContext & _searchCtx;
search::attribute::IAttributeContext & _attrCtx;
search::IAttributeManager & _attrMgr;
@@ -36,7 +41,7 @@ public:
DocsumContext(const search::engine::DocsumRequest & request,
search::docsummary::IDocsumWriter & docsumWriter,
search::docsummary::IDocsumStore & docsumStore,
- const matching::Matcher::SP & matcher,
+ std::shared_ptr<matching::Matcher> matcher,
matching::ISearchContext & searchCtx,
search::attribute::IAttributeContext & attrCtx,
search::IAttributeManager & attrMgr,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
index 71b1164d127..a9f87cb249e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp
@@ -1,6 +1,8 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "docsum_matcher.h"
+#include "match_tools.h"
+#include "search_session.h"
#include <vespa/eval/eval/tensor.h>
#include <vespa/eval/eval/tensor_engine.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -9,6 +11,8 @@
#include <vespa/searchlib/queryeval/intermediate_blueprints.h>
#include <vespa/searchlib/queryeval/same_element_blueprint.h>
#include <vespa/searchlib/queryeval/same_element_search.h>
+#include <vespa/searchlib/fef/feature_resolver.h>
+#include <vespa/searchlib/fef/rank_program.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.matching.docsum_matcher");
@@ -30,9 +34,10 @@ namespace proton::matching {
namespace {
-FeatureSet::UP get_feature_set(const MatchToolsFactory &mtf,
- const std::vector<uint32_t> &docs,
- bool summaryFeatures)
+FeatureSet::UP
+get_feature_set(const MatchToolsFactory &mtf,
+ const std::vector<uint32_t> &docs,
+ bool summaryFeatures)
{
MatchTools::UP matchTools = mtf.createMatchTools();
if (summaryFeatures) {
@@ -143,7 +148,7 @@ DocsumMatcher::DocsumMatcher()
{
}
-DocsumMatcher::DocsumMatcher(SearchSession::SP session, std::vector<uint32_t> docs)
+DocsumMatcher::DocsumMatcher(std::shared_ptr<SearchSession> session, std::vector<uint32_t> docs)
: _from_session(std::move(session)),
_from_mtf(),
_mtf(&_from_session->getMatchToolsFactory()),
@@ -151,7 +156,7 @@ DocsumMatcher::DocsumMatcher(SearchSession::SP session, std::vector<uint32_t> do
{
}
-DocsumMatcher::DocsumMatcher(MatchToolsFactory::UP mtf, std::vector<uint32_t> docs)
+DocsumMatcher::DocsumMatcher(std::unique_ptr<MatchToolsFactory> mtf, std::vector<uint32_t> docs)
: _from_session(),
_from_mtf(std::move(mtf)),
_mtf(_from_mtf.get()),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.h b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.h
index e1eb76be843..7fdfbc1d2ba 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.h
@@ -2,8 +2,6 @@
#pragma once
-#include "search_session.h"
-#include "match_tools.h"
#include <vespa/searchlib/common/featureset.h>
#include <vespa/searchlib/common/struct_field_mapper.h>
#include <vespa/searchlib/common/matching_elements.h>
@@ -12,6 +10,9 @@
namespace proton::matching {
+class MatchToolsFactory;
+class SearchSession;
+
/**
* Used to perform additional matching related to a docsum
* request. Note that external objects must be kept alive by the one
@@ -24,15 +25,15 @@ private:
using StructFieldMapper = search::StructFieldMapper;
using MatchingElements = search::MatchingElements;
- SearchSession::SP _from_session;
- MatchToolsFactory::UP _from_mtf;
+ std::shared_ptr<SearchSession> _from_session;
+ std::unique_ptr<MatchToolsFactory> _from_mtf;
MatchToolsFactory *_mtf;
std::vector<uint32_t> _docs;
public:
DocsumMatcher();
- DocsumMatcher(SearchSession::SP session, std::vector<uint32_t> docs);
- DocsumMatcher(MatchToolsFactory::UP mtf, std::vector<uint32_t> docs);
+ DocsumMatcher(std::shared_ptr<SearchSession> session, std::vector<uint32_t> docs);
+ DocsumMatcher(std::unique_ptr<MatchToolsFactory> mtf, std::vector<uint32_t> docs);
~DocsumMatcher();
using UP = std::unique_ptr<DocsumMatcher>;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index b3b97da6752..370569276d5 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -4,14 +4,12 @@
#include "docid_range_scheduler.h"
#include "match_loop_communicator.h"
#include "match_thread.h"
-#include <vespa/searchlib/attribute/attribute_operation.h>
+#include "match_tools.h"
#include <vespa/searchlib/engine/trace.h>
-#include <vespa/searchlib/common/featureset.h>
#include <vespa/vespalib/util/thread_bundle.h>
#include <vespa/vespalib/data/slime/inserter.h>
#include <vespa/vespalib/data/slime/inject.h>
#include <vespa/vespalib/data/slime/cursor.h>
-#include <vespa/eval/eval/tensor.h>
#include <vespa/eval/eval/tensor_engine.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -23,7 +21,6 @@ namespace proton::matching {
using namespace search::fef;
using search::queryeval::SearchIterator;
using search::FeatureSet;
-using search::attribute::AttributeOperation;
namespace {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp
index 549aee20de7..132caa8bd62 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "match_params.h"
+#include <algorithm>
namespace proton::matching {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_params.h b/searchcore/src/vespa/searchcore/proton/matching/match_params.h
index c1fd9a4ef32..8590d9640fd 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_params.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_params.h
@@ -2,7 +2,8 @@
#pragma once
-#include <vespa/searchlib/fef/fef.h>
+#include <vespa/searchlib/common/feature.h>
+#include <cstdint>
namespace proton::matching {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index e2695340725..afdae5eec2e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -2,14 +2,12 @@
#include "match_thread.h"
#include "document_scorer.h"
-#include <vespa/searchlib/engine/trace.h>
-#include <vespa/searchlib/attribute/attribute_operation.h>
-#include <vespa/searchcommon/attribute/i_attribute_functor.h>
+#include "match_tools.h"
#include <vespa/searchcore/grouping/groupingmanager.h>
#include <vespa/searchcore/grouping/groupingcontext.h>
+#include <vespa/searchlib/engine/trace.h>
+#include <vespa/searchlib/attribute/attribute_operation.h>
#include <vespa/searchlib/common/bitvector.h>
-#include <vespa/searchlib/common/featureset.h>
-#include <vespa/searchlib/query/base.h>
#include <vespa/searchlib/queryeval/multibitvectoriterator.h>
#include <vespa/searchlib/queryeval/andnotsearch.h>
#include <vespa/vespalib/util/closure.h>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index f1641af9a77..dca77f35019 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -2,7 +2,6 @@
#pragma once
-#include "match_tools.h"
#include "i_match_loop_communicator.h"
#include "match_params.h"
#include "matching_stats.h"
@@ -14,14 +13,22 @@
#include <vespa/searchlib/common/resultset.h>
#include <vespa/searchlib/common/sortresults.h>
#include <vespa/searchlib/queryeval/hitcollector.h>
+#include <vespa/searchlib/fef/featureexecutor.h>
namespace search::engine {
class Trace;
class RelativeTime;
}
+namespace search::fef {class RankProgram; }
+
+namespace search::queryeval { class SearchIterator; }
+
namespace proton::matching {
+class MatchTools;
+class MatchToolsFactory;
+
/**
* Runs a single match thread and keeps track of local state.
**/
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index 302765e152b..67c1fb25b64 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -2,14 +2,16 @@
#include "match_tools.h"
#include "querynodes.h"
+#include <vespa/searchcorespi/index/indexsearchable.h>
+#include <vespa/searchlib/fef/indexproperties.h>
+#include <vespa/searchlib/fef/ranksetup.h>
#include <vespa/searchlib/parsequery/stackdumpiterator.h>
#include <vespa/searchlib/attribute/diversity.h>
#include <vespa/searchlib/attribute/attribute_operation.h>
#include <vespa/searchlib/common/bitvector.h>
+
#include <vespa/log/log.h>
LOG_SETUP(".proton.matching.match_tools");
-#include <vespa/searchlib/query/tree/querytreecreator.h>
-#include <vespa/searchcorespi/index/indexsearchable.h>
using search::attribute::IAttributeContext;
using search::queryeval::IRequestContext;
@@ -33,7 +35,7 @@ bool contains_all(const HandleRecorder::HandleMap &old_map,
for (const auto &handle: new_map) {
const auto old_itr = old_map.find(handle.first);
if (old_itr == old_map.end() ||
- ((static_cast<int>(handle.second) & ~static_cast<int>(old_itr->second)) != 0)) {
+ ((int(handle.second) & ~int(old_itr->second)) != 0)) {
return false;
}
}
@@ -113,6 +115,11 @@ MatchTools::MatchTools(QueryLimiter & queryLimiter,
MatchTools::~MatchTools() = default;
+bool
+MatchTools::has_second_phase_rank() const {
+ return !_rankSetup.getSecondPhaseRank().empty();
+}
+
void
MatchTools::setup_first_phase()
{
@@ -239,6 +246,11 @@ MatchToolsFactory::createOnSummaryTask() const {
execute::onsummary::Operation::lookup(_queryEnv.getProperties()));
}
+bool
+MatchToolsFactory::has_first_phase_rank() const {
+ return !_rankSetup.getFirstPhaseRank().empty();
+}
+
AttributeOperationTask::AttributeOperationTask(const RequestContext & requestContext,
vespalib::stringref attribute, vespalib::stringref operation)
: _requestContext(requestContext),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index bbdf30939db..777652c6b89 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -12,12 +12,15 @@
#include "requestcontext.h"
#include <vespa/searchcommon/attribute/i_attribute_functor.h>
#include <vespa/searchlib/queryeval/blueprint.h>
-#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/common/idocumentmetastore.h>
#include <vespa/searchlib/queryeval/idiversifier.h>
#include <vespa/vespalib/util/doom.h>
#include <vespa/vespalib/util/clock.h>
+namespace search::fef {
+ class RankProgram;
+ class RankSetup;
+}
namespace proton::matching {
class MatchTools
@@ -32,12 +35,12 @@ private:
const QueryEnvironment &_queryEnv;
const search::fef::RankSetup &_rankSetup;
const search::fef::Properties &_featureOverrides;
- search::fef::MatchData::UP _match_data;
- search::fef::RankProgram::UP _rank_program;
+ std::unique_ptr<search::fef::MatchData> _match_data;
+ std::unique_ptr<search::fef::RankProgram> _rank_program;
search::queryeval::SearchIterator::UP _search;
HandleRecorder::HandleMap _used_handles;
bool _search_has_changed;
- void setup(search::fef::RankProgram::UP, double termwise_limit = 1.0);
+ void setup(std::unique_ptr<search::fef::RankProgram>, double termwise_limit = 1.0);
public:
typedef std::unique_ptr<MatchTools> UP;
MatchTools(const MatchTools &) = delete;
@@ -56,7 +59,7 @@ public:
const vespalib::Doom &getHardDoom() const { return _hardDoom; }
QueryLimiter & getQueryLimiter() { return _queryLimiter; }
MaybeMatchPhaseLimiter &match_limiter() { return _match_limiter; }
- bool has_second_phase_rank() const { return !_rankSetup.getSecondPhaseRank().empty(); }
+ bool has_second_phase_rank() const;
const search::fef::MatchData &match_data() const { return *_match_data; }
search::fef::RankProgram &rank_program() { return *_rank_program; }
search::queryeval::SearchIterator &search() { return *_search; }
@@ -126,12 +129,11 @@ public:
bool should_diversify() const { return _diversityParams.enabled(); }
std::unique_ptr<search::queryeval::IDiversifier> createDiversifier(uint32_t heapSize) const;
search::queryeval::Blueprint::HitEstimate estimate() const { return _query.estimate(); }
- bool has_first_phase_rank() const { return !_rankSetup.getFirstPhaseRank().empty(); }
+ bool has_first_phase_rank() const;
std::unique_ptr<AttributeOperationTask> createOnMatchTask() const;
std::unique_ptr<AttributeOperationTask> createOnReRankTask() const;
std::unique_ptr<AttributeOperationTask> createOnSummaryTask() const;
- const RequestContext & requestContext() const { return _requestContext; }
const Query & query() const { return _query; }
};
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index dace9674d64..2764bfb96df 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -12,6 +12,8 @@
#include <vespa/searchlib/engine/searchrequest.h>
#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/searchlib/features/setup.h>
+#include <vespa/searchlib/fef/indexproperties.h>
+#include <vespa/searchlib/fef/ranksetup.h>
#include <vespa/searchlib/fef/test/plugin/setup.h>
#include <vespa/vespalib/data/slime/inserter.h>
@@ -365,4 +367,14 @@ Matcher::create_docsum_matcher(const DocsumRequest &req, ISearchContext &search_
return std::make_unique<DocsumMatcher>(std::move(mtf), std::move(docs));
}
+bool
+Matcher::canProduceSummaryFeatures() const {
+ return ! _rankSetup->getSummaryFeatures().empty();
+}
+
+double
+Matcher::get_termwise_limit() const {
+ return _rankSetup->get_termwise_limit();
+}
+
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
index bbfcad04e15..4d3d32a96e4 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
@@ -10,12 +10,12 @@
#include "docsum_matcher.h"
#include <vespa/searchcore/proton/matching/querylimiter.h>
#include <vespa/searchcommon/attribute/i_attribute_functor.h>
+#include <vespa/searchlib/fef/blueprintfactory.h>
#include <vespa/searchlib/common/featureset.h>
#include <vespa/searchlib/common/struct_field_mapper.h>
#include <vespa/searchlib/common/matching_elements.h>
#include <vespa/searchlib/common/resultset.h>
#include <vespa/searchlib/queryeval/blueprint.h>
-#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/query/base.h>
#include <vespa/vespalib/util/clock.h>
#include <vespa/vespalib/util/closure.h>
@@ -35,6 +35,7 @@ namespace search::engine {
class SearchReply;
}
namespace search { struct IDocumentMetaStore; }
+namespace search::fef { class RankSetup; }
namespace proton::matching {
@@ -50,13 +51,14 @@ class Matcher
private:
using IAttributeContext = search::attribute::IAttributeContext;
using DocsumRequest = search::engine::DocsumRequest;
+ using SearchRequest = search::engine::SearchRequest;
using Properties = search::fef::Properties;
using my_clock = std::chrono::steady_clock;
using StructFieldMapper = search::StructFieldMapper;
using MatchingElements = search::MatchingElements;
IndexEnvironment _indexEnv;
search::fef::BlueprintFactory _blueprintFactory;
- search::fef::RankSetup::SP _rankSetup;
+ std::shared_ptr<search::fef::RankSetup> _rankSetup;
ViewResolver _viewResolver;
std::mutex _statsLock;
MatchingStats _stats;
@@ -124,7 +126,7 @@ public:
* @param metaStore the document meta store used to map from lid to gid
**/
std::unique_ptr<search::engine::SearchReply>
- match(const search::engine::SearchRequest &request, vespalib::ThreadBundle &threadBundle,
+ match(const SearchRequest &request, vespalib::ThreadBundle &threadBundle,
ISearchContext &searchContext, IAttributeContext &attrContext,
SessionManager &sessionManager, const search::IDocumentMetaStore &metaStore,
SearchSession::OwnershipBundle &&owned_objects);
@@ -179,8 +181,8 @@ public:
/**
* @return true if this rankprofile has summary-features enabled
**/
- bool canProduceSummaryFeatures() const { return ! _rankSetup->getSummaryFeatures().empty(); }
- double get_termwise_limit() const { return _rankSetup->get_termwise_limit(); }
+ bool canProduceSummaryFeatures() const;
+ double get_termwise_limit() const;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
index a7df151f2f0..7b09b34c46c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "matchers.h"
+#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
namespace proton {
@@ -17,9 +18,9 @@ Matchers::Matchers(const vespalib::Clock &clock,
Matchers::~Matchers() = default;
void
-Matchers::add(const vespalib::string &name, matching::Matcher::SP matcher)
+Matchers::add(const vespalib::string &name, std::shared_ptr<matching::Matcher> matcher)
{
- _rpmap[name] = matcher;
+ _rpmap[name] = std::move(matcher);
if ((name == "default") || ! _default) {
_default = matcher;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.h b/searchcore/src/vespa/searchcore/proton/server/matchers.h
index 3edbe0d3717..bd1b9ab069d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.h
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.h
@@ -2,17 +2,25 @@
#pragma once
-#include <vespa/searchcore/proton/matching/matcher.h>
+#include <vespa/searchcore/proton/matching/matching_stats.h>
#include <vespa/vespalib/stllike/hash_map.h>
+namespace vespalib { class Clock; }
+
namespace proton {
+namespace matching {
+ class Matcher;
+ class QueryLimiter;
+ class IConstantValueRepo;
+}
+
class Matchers {
private:
- typedef vespalib::hash_map<vespalib::string, matching::Matcher::SP> Map;
- Map _rpmap;
- matching::Matcher::SP _fallback;
- matching::Matcher::SP _default;
+ typedef vespalib::hash_map<vespalib::string, std::shared_ptr<matching::Matcher>> Map;
+ Map _rpmap;
+ std::shared_ptr<matching::Matcher> _fallback;
+ std::shared_ptr<matching::Matcher> _default;
public:
typedef std::shared_ptr<Matchers> SP;
typedef std::unique_ptr<Matchers> UP;
@@ -20,10 +28,10 @@ public:
matching::QueryLimiter &queryLimiter,
const matching::IConstantValueRepo &constantValueRepo);
~Matchers();
- void add(const vespalib::string &name, matching::Matcher::SP matcher);
+ void add(const vespalib::string &name, std::shared_ptr<matching::Matcher> matcher);
matching::MatchingStats getStats() const;
matching::MatchingStats getStats(const vespalib::string &name) const;
- matching::Matcher::SP lookup(const vespalib::string &name) const;
+ std::shared_ptr<matching::Matcher> lookup(const vespalib::string &name) const;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
index 9af648917c4..6f32f886637 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
@@ -2,6 +2,7 @@
#include "matchview.h"
#include "searchcontext.h"
+#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/searchlib/engine/searchrequest.h>
#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/vespalib/util/stringfmt.h>
@@ -58,7 +59,8 @@ MatchView::getMatcher(const vespalib::string & rankProfile) const
}
-MatchContext::UP MatchView::createContext() const {
+MatchContext::UP
+MatchView::createContext() const {
IAttributeContext::UP attrCtx = _attrMgr->createContext();
auto searchCtx = std::make_unique<SearchContext>(_indexSearchable, _docIdLimit.get());
return std::make_unique<MatchContext>(std::move(attrCtx), std::move(searchCtx));
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.h b/searchcore/src/vespa/searchcore/proton/server/matchview.h
index 511048f536f..983e06d3414 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.h
@@ -7,7 +7,7 @@
#include <vespa/searchcore/proton/common/docid_limit.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
#include <vespa/searchcore/proton/matching/match_context.h>
-#include <vespa/searchcore/proton/matching/matcher.h>
+#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcorespi/index/indexsearchable.h>
#include <vespa/searchlib/attribute/attributevector.h>
@@ -15,7 +15,9 @@ namespace proton {
namespace matching {
class SessionManager;
+ class Matcher;
}
+
class MatchView {
using SessionManagerSP = std::shared_ptr<matching::SessionManager>;
Matchers::SP _matchers;
@@ -50,7 +52,7 @@ public:
DocIdLimit & getDocIdLimit() const { return _docIdLimit; }
// Throws on error.
- matching::Matcher::SP getMatcher(const vespalib::string & rankProfile) const;
+ std::shared_ptr<matching::Matcher> getMatcher(const vespalib::string & rankProfile) const;
matching::MatchingStats
getMatcherStats(const vespalib::string &rankProfile) const {
@@ -60,7 +62,7 @@ public:
matching::MatchContext::UP createContext() const;
std::unique_ptr<search::engine::SearchReply>
- match(const ISearchHandler::SP &searchHandler,
+ match(const std::shared_ptr<ISearchHandler> &searchHandler,
const search::engine::SearchRequest &req,
vespalib::ThreadBundle &threadBundle) const;
};
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 42dcd2f97d5..069d3727850 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
@@ -2,6 +2,7 @@
#include "reconfig_params.h"
#include "searchable_doc_subdb_configurer.h"
+#include <vespa/searchcore/proton/matching/matcher.h>
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/common/document_type_inspector.h>
@@ -43,7 +44,7 @@ SearchableDocSubDBConfigurer::reconfigureFeedView(const IIndexWriter::SP &indexW
const SearchView::SP &searchView)
{
SearchableFeedView::SP curr = _feedView.get();
- _feedView.set(SearchableFeedView::SP(new SearchableFeedView(
+ _feedView.set(std::make_shared<SearchableFeedView>(
StoreOnlyFeedView::Context(summaryAdapter,
schema,
searchView->getDocumentMetaStore(),
@@ -53,7 +54,7 @@ SearchableDocSubDBConfigurer::reconfigureFeedView(const IIndexWriter::SP &indexW
curr->getLidReuseDelayer(), curr->getCommitTimeTracker()),
curr->getPersistentParams(),
FastAccessFeedView::Context(attrWriter, curr->getDocIdLimit()),
- SearchableFeedView::Context(indexWriter))));
+ SearchableFeedView::Context(indexWriter)));
}
void
@@ -115,7 +116,7 @@ SearchableDocSubDBConfigurer(const ISummaryManager::SP &summaryMgr,
_distributionKey(distributionKey)
{ }
-SearchableDocSubDBConfigurer::~SearchableDocSubDBConfigurer() { }
+SearchableDocSubDBConfigurer::~SearchableDocSubDBConfigurer() = default;
Matchers::UP
SearchableDocSubDBConfigurer::createMatchers(const Schema::SP &schema,
@@ -130,7 +131,7 @@ SearchableDocSubDBConfigurer::createMatchers(const Schema::SP &schema,
property.value);
}
// schema instance only used during call.
- Matcher::SP profptr(new Matcher(*schema, properties, _clock, _queryLimiter, _constantValueRepo, _distributionKey));
+ auto profptr = std::make_shared<Matcher>(*schema, properties, _clock, _queryLimiter, _constantValueRepo, _distributionKey);
newMatchers->add(name, profptr);
}
return newMatchers;
@@ -227,8 +228,7 @@ SearchableDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig,
shouldFeedViewChange = true;
}
- ISummaryManager::ISummarySetup::SP sumSetup =
- _searchView.get()->getSummarySetup();
+ ISummaryManager::ISummarySetup::SP sumSetup = _searchView.get()->getSummarySetup();
if (params.shouldSummaryManagerChange() ||
params.shouldAttributeManagerChange())
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index dc200502917..85c30462ee3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -14,6 +14,8 @@
#include <vespa/searchcore/proton/reference/document_db_reference.h>
#include <vespa/searchcore/proton/reference/gid_to_lid_change_handler.h>
#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h>
+#include <vespa/searchlib/fef/indexproperties.h>
+#include <vespa/searchlib/fef/properties.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/eval/tensor/default_tensor_engine.h>
@@ -91,19 +93,19 @@ createIndexManagerInitializer(const DocumentDBConfig &configSnapshot, SerialNum
const IndexConfig &indexCfg,
std::shared_ptr<searchcorespi::IIndexManager::SP> indexManager) const
{
- Schema::SP schema(configSnapshot.getSchemaSP());
+ const Schema::SP & schema(configSnapshot.getSchemaSP());
vespalib::string vespaIndexDir(_baseDir + "/index");
// Note: const_cast for reconfigurer role
return std::make_shared<IndexManagerInitializer>
(vespaIndexDir, indexCfg, *schema, configSerialNum, const_cast<SearchableDocSubDB &>(*this),
_writeService, _warmupExecutor, configSnapshot.getTuneFileDocumentDBSP()->_index,
- configSnapshot.getTuneFileDocumentDBSP()->_attr, _fileHeaderContext, indexManager);
+ configSnapshot.getTuneFileDocumentDBSP()->_attr, _fileHeaderContext, std::move(indexManager));
}
void
SearchableDocSubDB::setupIndexManager(searchcorespi::IIndexManager::SP indexManager)
{
- _indexMgr = indexManager;
+ _indexMgr = std::move(indexManager);
_indexWriter = std::make_shared<IndexWriter>(_indexMgr);
}
@@ -263,7 +265,7 @@ reconfigure(vespalib::Closure0<bool>::UP closure)
bool ret = true;
- if (closure.get() != NULL)
+ if (closure.get() != nullptr)
ret = closure->call(); // Perform index manager reconfiguration now
reconfigureIndexSearchable();
return ret;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
index c5572923784..9830048cdd8 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
@@ -1,6 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "searchcontext.h"
#include "searchview.h"
#include <vespa/searchcore/proton/docsummary/docsumcontext.h>
#include <vespa/searchlib/engine/searchreply.h>
@@ -145,9 +144,8 @@ SearchView::getDocsumsInternal(const DocsumRequest & req)
convertGidsToLids(req, metaStore, _matchView->getDocIdLimit().get());
IDocsumStore::UP store(_summarySetup->createDocsumStore(req.resultClassName));
- Matcher::SP matcher = _matchView->getMatcher(req.ranking);
MatchContext::UP mctx = _matchView->createContext();
- auto ctx = std::make_unique<DocsumContext>(req, _summarySetup->getDocsumWriter(), *store, matcher,
+ auto ctx = std::make_unique<DocsumContext>(req, _summarySetup->getDocsumWriter(), *store, _matchView->getMatcher(req.ranking),
mctx->getSearchContext(), mctx->getAttributeContext(),
*_summarySetup->getAttributeManager(), *getSessionManager());
SearchView::InternalDocsumReply reply(ctx->getDocsums(), true);