aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/wand
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/vespa/searchlib/queryeval/wand')
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp
index fe212666ec9..b4b55098eaa 100644
--- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp
@@ -56,6 +56,12 @@ ParallelWeakAndBlueprint::getNextChildField(const FieldSpec &outer)
}
void
+ParallelWeakAndBlueprint::reserve(size_t num_children) {
+ _weights.reserve(num_children);
+ _terms.reserve(num_children);
+}
+
+void
ParallelWeakAndBlueprint::addTerm(Blueprint::UP term, int32_t weight)
{
HitEstimate childEst = term->getState().estimate();
@@ -78,6 +84,7 @@ ParallelWeakAndBlueprint::createLeafSearch(const search::fef::TermFieldMatchData
assert(tfmda.size() == 1);
fef::MatchData::UP childrenMatchData = _layout.createMatchData();
wand::Terms terms;
+ terms.reserve(_terms.size());
for (size_t i = 0; i < _terms.size(); ++i) {
const State &childState = _terms[i]->getState();
assert(childState.numFields() == 1);
diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h
index 1a481be5c32..a2c13f12485 100644
--- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h
@@ -44,7 +44,7 @@ public:
score_t scoreThreshold,
double thresholdBoostFactor,
uint32_t scoresAdjustFrequency);
- virtual ~ParallelWeakAndBlueprint() override;
+ ~ParallelWeakAndBlueprint() override;
const WeakAndHeap &getScores() const { return _scores; }
@@ -56,6 +56,7 @@ public:
FieldSpec getNextChildField(const FieldSpec &outer);
// Used by create visitor
+ void reserve(size_t num_children);
void addTerm(Blueprint::UP term, int32_t weight);
SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;