aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-09-25 13:25:16 +0200
committerGitHub <noreply@github.com>2023-09-25 13:25:16 +0200
commit83c7120ea16e0b09e0b8ee47ae254d0a83f8649d (patch)
tree4db95f8bf4f48bf07fa924733dc6782a56d9bd71 /searchlib/src
parentc354b5215d13d8d8993c587e85892aa8aa7b5103 (diff)
parent0f5fddc01f36a7477a1db04a4c3752f003b2a10c (diff)
Merge pull request #28626 from vespa-engine/balder/balder/wire-doom-into-fetch-postings
Wire in doom and let hitrate be a float int
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/blueprint.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/executeinfo.h38
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp15
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp8
8 files changed, 47 insertions, 40 deletions
diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
index ef0fd56840a..c617db871a7 100644
--- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
@@ -128,9 +128,9 @@ TEST("test And propagates updated histestimate") {
const RememberExecuteInfo & child = dynamic_cast<const RememberExecuteInfo &>(bp.getChild(i));
EXPECT_EQUAL((i == 0), child.executeInfo.isStrict());
}
- EXPECT_EQUAL(1.0, dynamic_cast<const RememberExecuteInfo &>(bp.getChild(0)).executeInfo.hitRate());
- EXPECT_EQUAL(1.0/250, dynamic_cast<const RememberExecuteInfo &>(bp.getChild(1)).executeInfo.hitRate());
- EXPECT_EQUAL(1.0/(250*25), dynamic_cast<const RememberExecuteInfo &>(bp.getChild(2)).executeInfo.hitRate());
+ EXPECT_EQUAL(1.0f, dynamic_cast<const RememberExecuteInfo &>(bp.getChild(0)).executeInfo.hitRate());
+ EXPECT_EQUAL(1.0f/250, dynamic_cast<const RememberExecuteInfo &>(bp.getChild(1)).executeInfo.hitRate());
+ EXPECT_EQUAL(1.0f/(250*25), dynamic_cast<const RememberExecuteInfo &>(bp.getChild(2)).executeInfo.hitRate());
}
TEST("test And Blueprint") {
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
index 3f6085ef7ff..94d1a4917fd 100644
--- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
@@ -621,7 +621,7 @@ IntermediateBlueprint::fetchPostings(const ExecuteInfo &execInfo)
double nextHitRate = execInfo.hitRate();
for (size_t i = 0; i < _children.size(); ++i) {
Blueprint & child = *_children[i];
- child.fetchPostings(ExecuteInfo::create(execInfo.isStrict() && inheritStrict(i), nextHitRate));
+ child.fetchPostings(ExecuteInfo::create(execInfo.isStrict() && inheritStrict(i), nextHitRate, execInfo.getDoom()));
nextHitRate = computeNextHitRate(child, nextHitRate);
}
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
index 795f5f1424a..4322cafb5c8 100644
--- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp
@@ -66,7 +66,7 @@ DotProductBlueprint::createFilterSearch(bool strict, FilterConstraint constraint
void
DotProductBlueprint::fetchPostings(const ExecuteInfo &execInfo)
{
- ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo.hitRate());
+ ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo);
for (size_t i = 0; i < _terms.size(); ++i) {
_terms[i]->fetchPostings(childInfo);
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
index 604e20d2262..e5d20f047f5 100644
--- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
@@ -4,17 +4,7 @@
namespace search::queryeval {
-const ExecuteInfo ExecuteInfo::TRUE(true, 1.0);
-const ExecuteInfo ExecuteInfo::FALSE(false, 1.0);
-
-ExecuteInfo
-ExecuteInfo::create(bool strict) {
- return create(strict, 1.0);
-}
-
-ExecuteInfo
-ExecuteInfo::create(bool strict, double hitRate) {
- return ExecuteInfo(strict, hitRate);
-}
+const ExecuteInfo ExecuteInfo::TRUE(true, 1.0, nullptr);
+const ExecuteInfo ExecuteInfo::FALSE(false, 1.0, nullptr);
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
index e161b2bdab7..2dd34284bef 100644
--- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
+++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
@@ -1,8 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-// Copyright 2019 Oath inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+#include <vespa/vespalib/util/doom.h>
+
namespace search::queryeval {
/**
@@ -11,20 +12,37 @@ namespace search::queryeval {
*/
class ExecuteInfo {
public:
- ExecuteInfo() : ExecuteInfo(false, 1.0) { }
- bool isStrict() const { return _strict; }
- double hitRate() const { return _hitRate; }
+ ExecuteInfo() noexcept : ExecuteInfo(false, 1.0F, nullptr) { }
+ bool isStrict() const noexcept { return _strict; }
+ float hitRate() const noexcept { return _hitRate; }
+ bool soft_doom() const noexcept { return _doom && _doom->soft_doom(); }
+ const vespalib::Doom * getDoom() const { return _doom; }
static const ExecuteInfo TRUE;
static const ExecuteInfo FALSE;
- static ExecuteInfo create(bool strict);
- static ExecuteInfo create(bool strict, double HitRate);
+ static ExecuteInfo create(bool strict, const ExecuteInfo & org) noexcept {
+ return {strict, org._hitRate, org.getDoom()};
+ }
+ static ExecuteInfo create(bool strict, const vespalib::Doom * doom) noexcept {
+ return create(strict, 1.0F, doom);
+ }
+ static ExecuteInfo create(bool strict, float hitRate, const vespalib::Doom * doom) noexcept {
+ return {strict, hitRate, doom};
+ }
+ static ExecuteInfo create(bool strict) noexcept {
+ return create(strict, 1.0F);
+ }
+ static ExecuteInfo create(bool strict, float hitRate) noexcept {
+ return create(strict, hitRate, nullptr);
+ }
private:
- ExecuteInfo(bool strict, double hitRate_in)
- : _hitRate(hitRate_in),
+ ExecuteInfo(bool strict, float hitRate_in, const vespalib::Doom * doom) noexcept
+ : _doom(doom),
+ _hitRate(hitRate_in),
_strict(strict)
{ }
- double _hitRate;
- bool _strict;
+ const vespalib::Doom * _doom;
+ float _hitRate;
+ bool _strict;
};
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
index 9c3910b20f9..16461487525 100644
--- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
@@ -57,7 +57,7 @@ void
SameElementBlueprint::fetchPostings(const ExecuteInfo &execInfo)
{
for (size_t i = 0; i < _terms.size(); ++i) {
- _terms[i]->fetchPostings(ExecuteInfo::create(execInfo.isStrict() && (i == 0), execInfo.hitRate()));
+ _terms[i]->fetchPostings(ExecuteInfo::create(execInfo.isStrict() && (i == 0), execInfo));
}
}
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 48a09f099a6..eb6241a99d5 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
@@ -4,7 +4,6 @@
#include "wand_parts.h"
#include "parallel_weak_and_search.h"
#include <vespa/searchlib/queryeval/field_spec.hpp>
-#include <vespa/searchlib/queryeval/emptysearch.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
#include <vespa/vespalib/objects/visit.hpp>
@@ -77,10 +76,10 @@ ParallelWeakAndBlueprint::createLeafSearch(const search::fef::TermFieldMatchData
const State &childState = _terms[i]->getState();
assert(childState.numFields() == 1);
// TODO: pass ownership with unique_ptr
- terms.push_back(wand::Term(_terms[i]->createSearch(*childrenMatchData, true).release(),
- _weights[i],
- childState.estimate().estHits,
- childState.field(0).resolve(*childrenMatchData)));
+ terms.emplace_back(_terms[i]->createSearch(*childrenMatchData, true).release(),
+ _weights[i],
+ childState.estimate().estHits,
+ childState.field(0).resolve(*childrenMatchData));
}
return SearchIterator::UP
(ParallelWeakAndSearch::create(terms,
@@ -101,9 +100,9 @@ ParallelWeakAndBlueprint::createFilterSearch(bool strict, FilterConstraint const
void
ParallelWeakAndBlueprint::fetchPostings(const ExecuteInfo & execInfo)
{
- ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo.hitRate());
- for (size_t i = 0; i < _terms.size(); ++i) {
- _terms[i]->fetchPostings(childInfo);
+ ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo);
+ for (const auto & _term : _terms) {
+ _term->fetchPostings(childInfo);
}
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
index 4e06f170253..77d9875bf69 100644
--- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp
@@ -120,16 +120,16 @@ WeightedSetTermBlueprint::create_matching_elements_search(const MatchingElements
if (fields.has_field(_children_field.getName())) {
return std::make_unique<WeightedSetTermMatchingElementsSearch>(*this, _children_field.getName(), _terms);
} else {
- return std::unique_ptr<MatchingElementsSearch>();
+ return {};
}
}
void
WeightedSetTermBlueprint::fetchPostings(const ExecuteInfo &execInfo)
{
- ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo.hitRate());
- for (size_t i = 0; i < _terms.size(); ++i) {
- _terms[i]->fetchPostings(childInfo);
+ ExecuteInfo childInfo = ExecuteInfo::create(true, execInfo);
+ for (const auto & _term : _terms) {
+ _term->fetchPostings(childInfo);
}
}