From 97da6db442eb0385571f834c75a8d65bd239c620 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Thu, 14 Mar 2024 12:40:34 +0000 Subject: tag blueprints with strictness The strict-aware sort function is responsible for propagating and tagging strictness throughout the blueprint tree. Use pre-tagged strictness in fetchPostings, createSearch and createFilterSearch. --- .../match_phase_limiter_test.cpp | 14 ++++---- .../src/tests/proton/matching/query_test.cpp | 40 +++++++++++++--------- .../src/tests/proton/matching/querynodes_test.cpp | 5 +-- 3 files changed, 33 insertions(+), 26 deletions(-) (limited to 'searchcore/src/tests/proton/matching') diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp index 5e10d12e16f..6f398469fd3 100644 --- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp +++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp @@ -78,18 +78,18 @@ struct MockBlueprint : SimpleLeafBlueprint { search::queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { return default_flow_stats(docid_limit, 756, 0); } - SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override + SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda) const override { if (postings_fetched) { - EXPECT_EQUAL(postings_strict, strict); + EXPECT_EQUAL(postings_strict, strict()); } - return std::make_unique(spec, term, strict, tfmda, postings_fetched); + return std::make_unique(spec, term, strict(), tfmda, postings_fetched); } - SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { - return create_default_filter(strict, constraint); + SearchIteratorUP createFilterSearch(FilterConstraint constraint) const override { + return create_default_filter(constraint); } - void fetchPostings(const search::queryeval::ExecuteInfo &execInfo) override { - postings_strict = execInfo.is_strict(); + void fetchPostings(const search::queryeval::ExecuteInfo &) override { + postings_strict = strict(); postings_fetched = true; } }; diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index e798f87dd12..83b7e10c7a8 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -145,9 +145,9 @@ Fixture::getIterator(Node &node, ISearchContext &context) { _match_data = mdl.createMatchData(); _blueprint = BlueprintBuilder::build(_requestContext, node, context); - - _blueprint->fetchPostings(ExecuteInfo::TRUE); - SearchIterator::UP search(_blueprint->createSearch(*_match_data, true)); + _blueprint->basic_plan(true, 1000); + _blueprint->fetchPostings(ExecuteInfo::FULL); + SearchIterator::UP search(_blueprint->createSearch(*_match_data)); search->initFullRange(); return search; } @@ -652,8 +652,8 @@ TEST("requireThatQueryGluesEverythingTogether") { MatchData::UP md = mdl.createMatchData(); EXPECT_EQUAL(1u, md->getNumTermFields()); - query.optimize(true); - query.fetchPostings(ExecuteInfo::TRUE); + query.optimize(true, true); + query.fetchPostings(ExecuteInfo::FULL); SearchIterator::UP search = query.createSearch(*md); ASSERT_TRUE(search); } @@ -685,7 +685,8 @@ checkQueryAddsLocation(const string &loc_in, const string &loc_out) { MatchData::UP md = mdl.createMatchData(); EXPECT_EQUAL(2u, md->getNumTermFields()); - query.fetchPostings(ExecuteInfo::TRUE); + // query.optimize(true, true); + query.fetchPostings(ExecuteInfo::FULL); SearchIterator::UP search = query.createSearch(*md); ASSERT_TRUE(search); if (!EXPECT_NOT_EQUAL(string::npos, search->asString().find(loc_out))) { @@ -788,15 +789,20 @@ TEST("requireThatFakeFieldSearchDumpsDiffer") Blueprint::UP l3(a.createBlueprint(requestContext, fields2, n3)); // field Blueprint::UP l4(b.createBlueprint(requestContext, fields1, n1)); // tag - l1->fetchPostings(ExecuteInfo::TRUE); - l2->fetchPostings(ExecuteInfo::TRUE); - l3->fetchPostings(ExecuteInfo::TRUE); - l4->fetchPostings(ExecuteInfo::TRUE); - - SearchIterator::UP s1(l1->createSearch(*match_data, true)); - SearchIterator::UP s2(l2->createSearch(*match_data, true)); - SearchIterator::UP s3(l3->createSearch(*match_data, true)); - SearchIterator::UP s4(l4->createSearch(*match_data, true)); + l1->basic_plan(true, 1000); + l2->basic_plan(true, 1000); + l3->basic_plan(true, 1000); + l4->basic_plan(true, 1000); + + l1->fetchPostings(ExecuteInfo::FULL); + l2->fetchPostings(ExecuteInfo::FULL); + l3->fetchPostings(ExecuteInfo::FULL); + l4->fetchPostings(ExecuteInfo::FULL); + + SearchIterator::UP s1(l1->createSearch(*match_data)); + SearchIterator::UP s2(l2->createSearch(*match_data)); + SearchIterator::UP s3(l3->createSearch(*match_data)); + SearchIterator::UP s4(l4->createSearch(*match_data)); EXPECT_NOT_EQUAL(s1->asString(), s2->asString()); EXPECT_NOT_EQUAL(s1->asString(), s3->asString()); @@ -904,8 +910,8 @@ TEST("requireThatWhiteListBlueprintCanBeUsed") query.reserveHandles(requestContext, context, mdl); MatchData::UP md = mdl.createMatchData(); - query.optimize(true); - query.fetchPostings(ExecuteInfo::TRUE); + query.optimize(true, true); + query.fetchPostings(ExecuteInfo::FULL); SearchIterator::UP search = query.createSearch(*md); SimpleResult exp = SimpleResult().addHit(1).addHit(5).addHit(7).addHit(11); SimpleResult act; diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp index f3c986d7fe4..64c6870499c 100644 --- a/searchcore/src/tests/proton/matching/querynodes_test.cpp +++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp @@ -205,8 +205,9 @@ public: MatchData::UP match_data = mdl.createMatchData(); Blueprint::UP blueprint = BlueprintBuilder::build(requestContext, node, context); - blueprint->fetchPostings(search::queryeval::ExecuteInfo::TRUE); - return blueprint->createSearch(*match_data, true)->asString(); + blueprint->basic_plan(true, 1000); + blueprint->fetchPostings(search::queryeval::ExecuteInfo::FULL); + return blueprint->createSearch(*match_data)->asString(); } template string getIteratorAsString(); -- cgit v1.2.3