summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-11-16 22:02:50 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-11-16 22:02:50 +0000
commit6964e970944848ce1494d9418667cdc67b0968a6 (patch)
tree9708ece0fba324ead73171d2abedc5fbb5ac45d6
parent95288586f39e69b5dfffcdd15d56f911b051b453 (diff)
Sometime forward declaration make the world of difference.
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/sessionmanager_test.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_context.h14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.h14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.cpp30
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.h27
10 files changed, 75 insertions, 36 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index e89ea33e0bd..90225b01a41 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -29,6 +29,8 @@ LOG_SETUP("matching_test");
#include <vespa/searchlib/queryeval/isourceselector.h>
#include <vespa/vespalib/util/simple_thread_bundle.h>
#include <vespa/searchcore/proton/matching/match_params.h>
+#include <vespa/searchcore/proton/matching/match_tools.h>
+#include <vespa/searchcore/proton/matching/match_context.h>
using namespace proton::matching;
using namespace proton;
diff --git a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
index 00c1ebeab16..24767eb36f7 100644
--- a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
+++ b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchcore/proton/matching/sessionmanager.h>
#include <vespa/searchcore/proton/matching/session_manager_explorer.h>
#include <vespa/searchcore/proton/matching/search_session.h>
+#include <vespa/searchcore/proton/matching/match_tools.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/testkit/testapp.h>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/matching/CMakeLists.txt
index 76cb9a91cf9..236fde0339a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/matching/CMakeLists.txt
@@ -27,6 +27,7 @@ vespa_add_library(searchcore_matching STATIC
ranking_constants.cpp
requestcontext.cpp
result_processor.cpp
+ search_session.cpp
session_manager_explorer.cpp
sessionmanager.cpp
termdataextractor.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_context.h b/searchcore/src/vespa/searchcore/proton/matching/match_context.h
index a37e08a9bc8..26748332e0a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_context.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_context.h
@@ -10,22 +10,22 @@ namespace proton {
namespace matching {
class MatchContext {
- search::attribute::IAttributeContext::UP _attrCtx;
- ISearchContext::UP _searchCtx;
+ using IAttributeContext = search::attribute::IAttributeContext;
+ IAttributeContext::UP _attrCtx;
+ ISearchContext::UP _searchCtx;
public:
typedef std::unique_ptr<MatchContext> UP;
- MatchContext(search::attribute::IAttributeContext::UP attrCtx,
- ISearchContext::UP searchCtx)
+ MatchContext(IAttributeContext::UP attrCtx, ISearchContext::UP searchCtx)
: _attrCtx(std::move(attrCtx)),
- _searchCtx(std::move(searchCtx)) {
+ _searchCtx(std::move(searchCtx))
+ {
assert(_attrCtx.get());
assert(_searchCtx.get());
}
- search::attribute::IAttributeContext &getAttributeContext() const
- { return *_attrCtx; }
+ IAttributeContext &getAttributeContext() const { return *_attrCtx; }
ISearchContext &getSearchContext() const { return *_searchCtx; }
void releaseEnumGuards() { _attrCtx->releaseEnumGuards(); }
};
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.h b/searchcore/src/vespa/searchcore/proton/matching/match_master.h
index 286937f79c7..a41efca5a5f 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.h
@@ -6,7 +6,6 @@
#include <vespa/vespalib/util/thread_bundle.h>
#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/searchlib/common/featureset.h>
-#include "match_tools.h"
#include "result_processor.h"
#include "match_params.h"
#include "matching_stats.h"
@@ -14,6 +13,8 @@
namespace proton {
namespace matching {
+class MatchToolsFactory;
+
/**
* Handles overall matching and keeps track of match threads.
**/
@@ -25,11 +26,11 @@ private:
public:
const MatchingStats &getStats() const { return _stats; }
ResultProcessor::Result::UP match(const MatchParams &params,
- vespalib::ThreadBundle &threadBundle,
- const MatchToolsFactory &matchToolsFactory,
- ResultProcessor &resultProcessor,
- uint32_t distributionKey,
- uint32_t numSearchPartitions);
+ vespalib::ThreadBundle &threadBundle,
+ const MatchToolsFactory &matchToolsFactory,
+ ResultProcessor &resultProcessor,
+ uint32_t distributionKey,
+ uint32_t numSearchPartitions);
static search::FeatureSet::SP
getFeatureSet(const MatchToolsFactory &matchToolsFactory,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index 9b26de82d0d..81a065c563f 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -20,7 +20,7 @@
namespace proton {
namespace matching {
-class MatchTools : public vespalib::noncopyable
+class MatchTools
{
private:
using IRequestContext = search::queryeval::IRequestContext;
@@ -34,9 +34,10 @@ private:
const search::fef::Properties & _featureOverrides;
search::fef::MatchDataLayout _mdl;
HandleRecorder _handleRecorder;
-
public:
typedef std::unique_ptr<MatchTools> UP;
+ MatchTools(const MatchTools &) = delete;
+ MatchTools & operator = (const MatchTools &) = delete;
MatchTools(QueryLimiter & queryLimiter,
const vespalib::Doom & softDoom,
const vespalib::Doom & hardDoom,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 62bff3380d8..811fb4587c9 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -6,6 +6,8 @@ LOG_SETUP(".proton.matching.matcher");
#include "isearchcontext.h"
#include "match_master.h"
+#include "match_context.h"
+#include "match_tools.h"
#include "match_params.h"
#include "matcher.h"
#include "query.h"
@@ -157,7 +159,7 @@ Matcher::getStats()
return stats;
}
-MatchToolsFactory::UP
+std::unique_ptr<MatchToolsFactory>
Matcher::create_match_tools_factory(const search::engine::Request &request,
ISearchContext &searchContext,
IAttributeContext &attrContext,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
index 51688674465..1b0fd68d08c 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
@@ -5,7 +5,6 @@
#include "i_constant_value_repo.h"
#include "indexenvironment.h"
#include "matching_stats.h"
-#include "match_tools.h"
#include "search_session.h"
#include "viewresolver.h"
#include <vespa/searchcore/proton/matching/querylimiter.h>
@@ -14,6 +13,7 @@
#include <vespa/searchlib/engine/docsumrequest.h>
#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/searchlib/engine/searchrequest.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>
@@ -38,6 +38,7 @@ namespace matching {
class ISearchContext;
class SessionManager;
+class MatchToolsFactory;
/**
* The Matcher is responsible for performing searches.
@@ -108,11 +109,12 @@ public:
* Create the low-level tools needed to perform matching. This
* function is exposed for testing purposes.
**/
- MatchToolsFactory::UP create_match_tools_factory(const search::engine::Request &request,
- ISearchContext &searchContext,
- search::attribute::IAttributeContext &attrContext,
- const search::IDocumentMetaStore &metaStore,
- const search::fef::Properties &feature_overrides) const;
+ std::unique_ptr<MatchToolsFactory>
+ create_match_tools_factory(const search::engine::Request &request,
+ ISearchContext &searchContext,
+ search::attribute::IAttributeContext &attrContext,
+ const search::IDocumentMetaStore &metaStore,
+ const search::fef::Properties &feature_overrides) const;
/**
* Perform a search against this matcher.
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
new file mode 100644
index 00000000000..579dda4bacd
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
@@ -0,0 +1,30 @@
+#include "search_session.h"
+#include "match_tools.h"
+#include "match_context.h"
+
+namespace proton {
+namespace matching {
+
+SearchSession::SearchSession(const SessionId &id, fastos::TimeStamp time_of_doom,
+ std::unique_ptr<MatchToolsFactory> match_tools_factory,
+ OwnershipBundle &&owned_objects)
+ : _session_id(id),
+ _create_time(fastos::ClockSystem::now()),
+ _time_of_doom(time_of_doom),
+ _owned_objects(std::move(owned_objects)),
+ _match_tools_factory(std::move(match_tools_factory))
+{
+}
+
+void
+SearchSession::releaseEnumGuards() {
+ _owned_objects.context->releaseEnumGuards();
+}
+
+SearchSession::~SearchSession() { }
+
+SearchSession::OwnershipBundle::OwnershipBundle() { }
+SearchSession::OwnershipBundle::~OwnershipBundle() { }
+
+}
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
index 5e0a50ce774..e257b0ec23e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
@@ -2,8 +2,6 @@
#pragma once
-#include "match_context.h"
-#include "match_tools.h"
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/vespalib/stllike/string.h>
#include <memory>
@@ -11,6 +9,9 @@
namespace proton {
namespace matching {
+class MatchToolsFactory;
+class MatchContext;
+
/**
* Holds enough data to perform a GetDocSum request. Makes sure the
* data is kept alive.
@@ -18,9 +19,13 @@ namespace matching {
class SearchSession {
public:
struct OwnershipBundle {
+ OwnershipBundle();
+ OwnershipBundle(OwnershipBundle &&) = default;
+ OwnershipBundle & operator = (OwnershipBundle &&) = default;
+ ~OwnershipBundle();
ISearchHandler::SP search_handler;
search::fef::Properties::UP feature_overrides;
- MatchContext::UP context;
+ std::unique_ptr<MatchContext> context;
};
private:
typedef vespalib::string SessionId;
@@ -29,24 +34,18 @@ private:
fastos::TimeStamp _create_time;
fastos::TimeStamp _time_of_doom;
OwnershipBundle _owned_objects;
- MatchToolsFactory::UP _match_tools_factory;
+ std::unique_ptr<MatchToolsFactory> _match_tools_factory;
public:
typedef std::shared_ptr<SearchSession> SP;
SearchSession(const SessionId &id, fastos::TimeStamp time_of_doom,
- MatchToolsFactory::UP match_tools_factory,
- OwnershipBundle &&owned_objects)
- : _session_id(id),
- _create_time(fastos::ClockSystem::now()),
- _time_of_doom(time_of_doom),
- _owned_objects(std::move(owned_objects)),
- _match_tools_factory(std::move(match_tools_factory)) {
- }
+ std::unique_ptr<MatchToolsFactory> match_tools_factory,
+ OwnershipBundle &&owned_objects);
+ ~SearchSession();
const SessionId &getSessionId() const { return _session_id; }
-
- void releaseEnumGuards() { _owned_objects.context->releaseEnumGuards(); }
+ void releaseEnumGuards();
/**
* Gets this session's create time.