diff options
18 files changed, 51 insertions, 49 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index f5c9e8baffa..c9951f0b60e 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -23,7 +23,6 @@ #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/hw_info.h> -#include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/threadstackexecutor.h> #include <filesystem> #include <thread> @@ -188,7 +187,7 @@ assertWhiteList(const SimpleResult &exp, Blueprint::UP whiteListBlueprint, bool { MatchDataLayout mdl; MatchData::UP md = mdl.createMatchData(); - whiteListBlueprint->fetchPostings(search::queryeval::ExecuteInfo::create(strict)); + whiteListBlueprint->fetchPostings(search::queryeval::ExecuteInfo::createForTest(strict)); whiteListBlueprint->setDocIdLimit(docIdLimit); SearchIterator::UP sb = whiteListBlueprint->createSearch(*md, strict); diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index 928e13a9fae..0b87734cec2 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -711,7 +711,7 @@ void Test::requireThatQueryGluesEverythingTogether() { EXPECT_EQUAL(1u, md->getNumTermFields()); query.optimize(); - query.fetchPostings(search::queryeval::ExecuteInfo::create(true, &requestContext.getDoom())); + query.fetchPostings(ExecuteInfo::create(true, 1.0F, &requestContext.getDoom())); SearchIterator::UP search = query.createSearch(*md); ASSERT_TRUE(search.get()); } @@ -744,7 +744,7 @@ void checkQueryAddsLocation(const string &loc_in, const string &loc_out) { MatchData::UP md = mdl.createMatchData(); EXPECT_EQUAL(2u, md->getNumTermFields()); - query.fetchPostings(search::queryeval::ExecuteInfo::create(true, &requestContext.getDoom())); + query.fetchPostings(ExecuteInfo::create(true, 1.0F, &requestContext.getDoom())); SearchIterator::UP search = query.createSearch(*md); ASSERT_TRUE(search.get()); if (!EXPECT_NOT_EQUAL(string::npos, search->asString().find(loc_out))) { @@ -966,7 +966,7 @@ Test::requireThatWhiteListBlueprintCanBeUsed() MatchData::UP md = mdl.createMatchData(); query.optimize(); - query.fetchPostings(search::queryeval::ExecuteInfo::create(true, &requestContext.getDoom())); + query.fetchPostings(ExecuteInfo::create(true, 1.0F, &requestContext.getDoom())); SearchIterator::UP search = query.createSearch(*md); SimpleResult exp = SimpleResult().addHit(1).addHit(5).addHit(7).addHit(11); SimpleResult act; @@ -1129,7 +1129,7 @@ public: { set_want_global_filter(want_global_filter); } - ~GlobalFilterBlueprint(); + ~GlobalFilterBlueprint() override; void set_global_filter(const GlobalFilter& filter_, double estimated_hit_ratio_) override { filter = filter_.shared_from_this(); estimated_hit_ratio = estimated_hit_ratio_; diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 955cd30714f..00a3f6bab7e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -247,7 +247,7 @@ Query::optimize() } void -Query::fetchPostings(const search::queryeval::ExecuteInfo & executeInfo) +Query::fetchPostings(const ExecuteInfo & executeInfo) { _blueprint->fetchPostings(executeInfo); } @@ -265,7 +265,7 @@ Query::handle_global_filter(const vespalib::Doom & doom, uint32_t docid_limit, _blueprint = Blueprint::optimize(std::move(_blueprint)); LOG(debug, "blueprint after handle_global_filter:\n%s\n", _blueprint->asString().c_str()); // strictness may change if optimized order changed: - fetchPostings(search::queryeval::ExecuteInfo::create(true, &doom)); + fetchPostings(ExecuteInfo::create(true, 1.0F, &doom)); } bool diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index c2d2d389d2c..1b5d6dbca60 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -23,6 +23,7 @@ class Query private: using Blueprint = search::queryeval::Blueprint; using GlobalFilter = search::queryeval::GlobalFilter; + using ExecuteInfo = search::queryeval::ExecuteInfo; search::query::Node::UP _query_tree; Blueprint::UP _blueprint; Blueprint::UP _whiteListBlueprint; @@ -98,7 +99,7 @@ public: * test to verify the original query without optimization. **/ void optimize(); - void fetchPostings(const search::queryeval::ExecuteInfo & executeInfo) ; + void fetchPostings(const ExecuteInfo & executeInfo) ; void handle_global_filter(const vespalib::Doom & doom, uint32_t docid_limit, double global_filter_lower_limit, double global_filter_upper_limit, diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp index 17a393d97eb..79bdd83dc88 100644 --- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp +++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp @@ -272,7 +272,7 @@ TEST_F("Strict iterator is marked as strict", Fixture) { TEST_F("Non-strict blueprint with high hit rate is strict", Fixture(false, FastSearchConfig::ExplicitlyEnabled)) { auto ctx = f.create_context(word_term("5678")); - ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.02)); + ctx->fetchPostings(queryeval::ExecuteInfo::createForTest(false, 0.02)); TermFieldMatchData match; auto iter = f.create_iterator(*ctx, match, false); @@ -281,7 +281,7 @@ TEST_F("Non-strict blueprint with high hit rate is strict", Fixture(false, FastS TEST_F("Non-strict blueprint with low hit rate is non-strict", Fixture(false, FastSearchConfig::ExplicitlyEnabled)) { auto ctx = f.create_context(word_term("5678")); - ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.01)); + ctx->fetchPostings(queryeval::ExecuteInfo::createForTest(false, 0.01)); TermFieldMatchData match; auto iter = f.create_iterator(*ctx, match, false); diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index 03e338ee284..029c3130609 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -220,7 +220,7 @@ Result do_search(IAttributeManager &attribute_manager, const Node &node, bool st Blueprint::UP bp = source.createBlueprint(requestContext, FieldSpec(field, fieldId, handle), node); ASSERT_TRUE(bp); Result result(bp->getState().estimate().estHits, bp->getState().estimate().empty); - bp->fetchPostings(queryeval::ExecuteInfo::create(strict, 1.0)); + bp->fetchPostings(queryeval::ExecuteInfo::createForTest(strict)); SearchIterator::UP iterator = bp->createSearch(*match_data, strict); ASSERT_TRUE(iterator); iterator->initRange(1, num_docs); diff --git a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp index 4ec73a1d313..16597b8b615 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp @@ -109,7 +109,7 @@ struct WS { FieldSpecList fields; fields.add(FieldSpec(field, fieldId, handle, ac.getAttribute(field)->getIsFilter())); queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node); - bp->fetchPostings(queryeval::ExecuteInfo::create(strict)); + bp->fetchPostings(queryeval::ExecuteInfo::createForTest(strict)); SearchIterator::UP sb = bp->createSearch(*md, strict); return sb; } @@ -125,7 +125,7 @@ struct WS { FieldSpecList fields; fields.add(FieldSpec(field, fieldId, handle)); queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node); - bp->fetchPostings(queryeval::ExecuteInfo::create(strict)); + bp->fetchPostings(queryeval::ExecuteInfo::createForTest(strict)); SearchIterator::UP sb = bp->createSearch(*md, strict); FakeResult result; sb->initRange(1, 10); diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 91b6efc26a6..343a5c8e38b 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -216,7 +216,7 @@ private: // test search iterator unpacking void fillForSearchIteratorUnpackingTest(IntegerAttribute * ia, bool extra); void testSearchIteratorUnpacking(const AttributePtr & ptr, SearchContext & sc, bool extra, bool strict) { - sc.fetchPostings(queryeval::ExecuteInfo::create(strict, 1.0)); + sc.fetchPostings(queryeval::ExecuteInfo::createForTest(strict)); for (bool withElementId : {false, true}) { testSearchIteratorUnpacking(ptr, sc, extra, strict, withElementId); } @@ -649,7 +649,7 @@ public: ~Verifier() override; SearchIterator::UP create(bool strict) const override { - _sc->fetchPostings(queryeval::ExecuteInfo::create(strict, 1.0)); + _sc->fetchPostings(queryeval::ExecuteInfo::createForTest(strict)); return _sc->createIterator(&_dummy, strict); } private: diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp index 7a8250a2e16..a663944938c 100644 --- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp @@ -122,7 +122,7 @@ TEST("test And propagates updated histestimate") { bp.addChild(ap(MyLeafSpec(2000).create<RememberExecuteInfo>()->setSourceId(2))); bp.optimize_self(); bp.setDocIdLimit(5000); - bp.fetchPostings(ExecuteInfo::create(true)); + bp.fetchPostings(ExecuteInfo::TRUE); EXPECT_EQUAL(3u, bp.childCnt()); for (uint32_t i = 0; i < bp.childCnt(); i++) { const RememberExecuteInfo & child = dynamic_cast<const RememberExecuteInfo &>(bp.getChild(i)); diff --git a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp index 4305f7da116..1538a9ce0df 100644 --- a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp +++ b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp @@ -73,7 +73,7 @@ struct DP { FieldSpecList fields; fields.add(FieldSpec(field, fieldId, handle, field_is_filter)); queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP sb = bp->createSearch(*md, strict); EXPECT_TRUE(dynamic_cast<DotProductSearch*>(sb.get()) != 0); sb->initFullRange(); diff --git a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp index 9b74f8a650f..c570c06a60b 100644 --- a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp +++ b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp @@ -1,12 +1,14 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("equiv_test"); + #include <vespa/searchlib/queryeval/leaf_blueprints.h> #include <vespa/searchlib/queryeval/intermediate_blueprints.h> #include <vespa/searchlib/queryeval/equiv_blueprint.h> #include <vespa/searchlib/fef/matchdatalayout.h> #include <vespa/vespalib/gtest/gtest.h> +#include <vespa/log/log.h> +LOG_SETUP("equiv_test"); + using namespace search::queryeval; using search::fef::MatchData; using search::fef::MatchDataLayout; @@ -17,7 +19,7 @@ using search::fef::FieldPositionsIterator; class EquivTest : public ::testing::Test { protected: EquivTest(); - ~EquivTest(); + ~EquivTest() override; void test_equiv(bool strict, bool unpack_normal_features, bool unpack_interleaved_features); }; @@ -57,7 +59,7 @@ EquivTest::test_equiv(bool strict, bool unpack_normal_features, bool unpack_inte data.setNeedNormalFeatures(unpack_normal_features); data.setNeedInterleavedFeatures(unpack_interleaved_features); } - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); diff --git a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp index 3bfdcd21ce6..8ddac327643 100644 --- a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp +++ b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp @@ -6,7 +6,6 @@ #include <vespa/searchlib/queryeval/fake_requestcontext.h> #include <vespa/searchlib/queryeval/blueprint.h> #include <vespa/searchlib/query/tree/intermediatenodes.h> -#include <vespa/searchlib/query/tree/termnodes.h> #include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/fef/matchdata.h> @@ -63,7 +62,7 @@ TEST_F(FakeSearchableTest, require_that_term_search_works) { bool strict = (i == 0); SCOPED_TRACE(strict ? "strict" : "non-strict"); MatchData::UP md = MatchData::makeTestInstance(100, 10); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -117,7 +116,7 @@ TEST_F(FakeSearchableTest, require_that_phrase_search_works) { bool strict = (i == 0); SCOPED_TRACE(strict ? "strict" : "non-strict"); MatchData::UP md = MatchData::makeTestInstance(100, 10); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -168,7 +167,7 @@ TEST_F(FakeSearchableTest, require_that_weigheted_set_search_works) { bool strict = (i == 0); SCOPED_TRACE(strict ? "strict" : "non-strict"); MatchData::UP md = MatchData::makeTestInstance(100, 10); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -239,7 +238,7 @@ TEST_F(FakeSearchableTest, require_that_multi_field_search_works) { bool strict = (i == 0); SCOPED_TRACE(strict ? "strict" : "non-strict"); MatchData::UP md = MatchData::makeTestInstance(100, 10); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); @@ -323,7 +322,7 @@ TEST_F(FakeSearchableTest, require_that_phrase_with_empty_child_works) { bool strict = (i == 0); SCOPED_TRACE(strict ? "strict" : "non-strict"); MatchData::UP md = MatchData::makeTestInstance(100, 10); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); diff --git a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp index 7c5a4648925..d05e6c8e4f4 100644 --- a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp +++ b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp @@ -6,7 +6,6 @@ #include <vespa/searchlib/queryeval/simpleresult.h> #include <vespa/searchlib/queryeval/same_element_blueprint.h> #include <vespa/searchlib/queryeval/same_element_search.h> -#include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/searchcommon/attribute/i_search_context.h> #include <vespa/searchlib/attribute/searchcontextelementiterator.h> #include <vespa/vespalib/test/insertion_operators.h> @@ -48,7 +47,7 @@ std::unique_ptr<SameElementBlueprint> make_blueprint(const std::vector<FakeResul Blueprint::UP finalize(Blueprint::UP bp, bool strict) { Blueprint::UP result = Blueprint::optimize(std::move(bp)); - result->fetchPostings(ExecuteInfo::create(strict)); + result->fetchPostings(ExecuteInfo::createForTest(strict)); result->freeze(); return result; } @@ -87,7 +86,7 @@ TEST("require that matching elements can be identified") { auto md = make_match_data(); auto search = bp->createSearch(*md, false); search->initRange(1, 1000); - SameElementSearch *se = dynamic_cast<SameElementSearch*>(search.get()); + auto *se = dynamic_cast<SameElementSearch*>(search.get()); ASSERT_TRUE(se != nullptr); TEST_DO(verify_elements(*se, 5, {3, 7})); TEST_DO(verify_elements(*se, 10, {})); @@ -148,7 +147,7 @@ TEST("require that attribute iterators are wrapped for element unpacking") { auto bp = finalize(make_blueprint({a,b}, true), true); auto md = make_match_data(); auto search = bp->createSearch(*md, false); - SameElementSearch *se = dynamic_cast<SameElementSearch*>(search.get()); + auto *se = dynamic_cast<SameElementSearch*>(search.get()); ASSERT_TRUE(se != nullptr); ASSERT_EQUAL(se->children().size(), 2u); EXPECT_TRUE(dynamic_cast<SearchContextElementIterator*>(se->children()[0].get()) != nullptr); diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp index 29d4dd2c457..cbe497d6363 100644 --- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp +++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp @@ -36,7 +36,7 @@ struct MyTerm : public search::queryeval::SimpleLeafBlueprint { setEstimate(HitEstimate(hits, (hits == 0))); } SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const override { - return SearchIterator::UP(); + return {}; } SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { return create_default_filter(strict, constraint); @@ -143,13 +143,13 @@ public: void fetchPostings(bool useBlueprint) { - ExecuteInfo execInfo = ExecuteInfo::create(_strict); + ExecuteInfo execInfo = ExecuteInfo::createForTest(_strict); if (useBlueprint) { _phrase.fetchPostings(execInfo); return; } - for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->fetchPostings(execInfo); + for (const auto & i : _children) { + i->fetchPostings(execInfo); } } @@ -167,8 +167,8 @@ public: childMatch.add(child_term_field_match_data); } SimplePhraseSearch::Children children; - for (size_t i = 0; i < _children.size(); ++i) { - children.push_back(_children[i]->createSearch(*_md, _strict)); + for (const auto & i : _children) { + children.push_back(i->createSearch(*_md, _strict)); } search = std::make_unique<SimplePhraseSearch>(std::move(children), MatchData::UP(), childMatch, _order, diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp index 77c9e1a8039..bb2e559106f 100644 --- a/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp +++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp @@ -74,7 +74,7 @@ TEST("test strictness") { blend_b->addChild(std::move(a_b)); blend_b->addChild(std::move(b_b)); Blueprint::UP bp(blend_b); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); SearchIterator::UP search = bp->createSearch(*md, strict); search->initFullRange(); SearchIterator &blend = *search; diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp index 2f3f0eb7392..fed4e7c9bbd 100644 --- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp +++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp @@ -68,7 +68,7 @@ struct WS { FieldSpecList fields; fields.add(FieldSpec(field, fieldId, handle)); auto bp = searchable.createBlueprint(requestContext, fields, *node); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); auto sb = bp->createSearch(*md, strict); return (dynamic_cast<WeightedSetTermSearch*>(sb.get()) != nullptr); } @@ -83,7 +83,7 @@ struct WS { FieldSpecList fields; fields.add(FieldSpec(field, fieldId, handle, field_is_filter)); auto bp = searchable.createBlueprint(requestContext, fields, *node); - bp->fetchPostings(ExecuteInfo::create(strict)); + bp->fetchPostings(ExecuteInfo::createForTest(strict)); auto sb = bp->createSearch(*md, strict); sb->initFullRange(); FakeResult result; diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h index 9e42bb4da8e..362b0826f67 100644 --- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h +++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h @@ -22,16 +22,13 @@ public: 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 createForTest(bool strict) noexcept { + return createForTest(strict, 1.0F); } - static ExecuteInfo create(bool strict, float hitRate) noexcept { + static ExecuteInfo createForTest(bool strict, float hitRate) noexcept { return create(strict, hitRate, nullptr); } private: diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp index 4674aee8314..6b2faac847e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp @@ -56,8 +56,13 @@ SameElementBlueprint::optimize_self() 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)); + if (_terms.empty()) return; + _terms[0]->fetchPostings(execInfo); + double hit_rate = execInfo.hitRate() * _terms[0]->hit_ratio(); + for (size_t i = 1; i < _terms.size(); ++i) { + Blueprint & term = *_terms[i]; + term.fetchPostings(ExecuteInfo::create(false, hit_rate, execInfo.getDoom())); + hit_rate = hit_rate * term.hit_ratio(); } } |