summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-27 12:22:57 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-27 12:22:57 +0200
commit8ee3a24c5a39f5940537968516050702ac45b3eb (patch)
treeda772aa213519d68e9f50a8ba5ab9c0cd5833b4a /searchcore
parent406bb7fca1f90f0ab97f6f6b4752ca3e235c08ce (diff)
Use explicit template instantiation to reduce code bloat
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h5
4 files changed, 18 insertions, 11 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 63c3be1aa14..9fae955022a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -123,7 +123,7 @@ MatchMaster::getFeatureSet(const MatchToolsFactory &mtf,
if (docs.empty()) {
return retval;
}
- FeatureSet &fs = *retval.get();
+ FeatureSet &fs = *retval;
SearchIterator &search = matchTools->search();
search.initRange(docs.front(), docs.back()+1);
@@ -141,8 +141,7 @@ MatchMaster::getFeatureSet(const MatchToolsFactory &mtf,
}
auto onSummaryTask = mtf.createOnSummaryTask();
if (onSummaryTask) {
- onSummaryTask->run(AttributeOperation::create(onSummaryTask->getAttributeType(),
- onSummaryTask->getOperation(), docs));
+ onSummaryTask->run(docs);
}
return retval;
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index da4e5972cd5..31b3e138373 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -282,8 +282,7 @@ MatchThread::findMatches(MatchTools &tools)
uint32_t reRanked = hits.reRank(scorer, std::move(kept_hits));
auto onReRankTask = mtf.createOnReRankTask();
if (onReRankTask) {
- onReRankTask->run(AttributeOperation::create(onReRankTask->getAttributeType(),
- onReRankTask->getOperation(), hits.getReRankedHits()));
+ onReRankTask->run(hits.getReRankedHits());
}
thread_stats.docsReRanked(reRanked);
}
@@ -354,8 +353,7 @@ MatchThread::processResult(const Doom & hardDoom,
const MatchToolsFactory & mtf = matchToolsFactory;
auto onMatchTask = mtf.createOnMatchTask();
if (onMatchTask ) {
- onMatchTask->run(AttributeOperation::create(onMatchTask->getAttributeType(), onMatchTask->getOperation(),
- search::ResultSet::stealResult(std::move(*result))));
+ onMatchTask->run(search::ResultSet::stealResult(std::move(*result)));
}
if (hasGrouping) {
context.grouping->setDistributionKey(_distributionKey);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index f2147029458..a00a90d7a10 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -4,6 +4,8 @@
#include "querynodes.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>
@@ -253,9 +255,16 @@ AttributeOperationTask::getAttributeType() const {
return attr ? attr->getBasicType() : BasicType::NONE;
}
+using search::attribute::AttributeOperation;
+
+template <typename Hits>
void
-AttributeOperationTask::run(std::shared_ptr<IAttributeFunctor> func) const {
- _requestContext.asyncForAttribute(_attribute, std::move(func));
+AttributeOperationTask::run(Hits docs) const {
+ _requestContext.asyncForAttribute(_attribute, AttributeOperation::create(getAttributeType(), getOperation(), std::move(docs)));
}
+template void AttributeOperationTask::run(std::vector<AttributeOperation::Hit>) const;
+template void AttributeOperationTask::run(std::vector<uint32_t >) const;
+template void AttributeOperationTask::run(AttributeOperation::FullResult) const;
+
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index af3665c4d72..8f04eebc50e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -74,10 +74,11 @@ public:
using IAttributeFunctor = search::attribute::IAttributeFunctor;
AttributeOperationTask(const RequestContext & requestContext,
vespalib::stringref attribute, vespalib::stringref operation);
- void run(std::shared_ptr<IAttributeFunctor> func) const;
+ template<typename Hits>
+ void run(Hits hits) const;
+private:
search::attribute::BasicType getAttributeType() const;
const vespalib::string & getOperation() const { return _operation; }
-private:
const RequestContext & _requestContext;
vespalib::string _attribute;
vespalib::string _operation;