diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-17 12:52:28 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-11-17 14:04:53 +0000 |
commit | c17330816012cbf496723bbf88333e7e9b361c0a (patch) | |
tree | f07ac9c8419e5cb332773cc96fd6f0bc6b76ea75 /searchcore/src | |
parent | 31c87dea54a00998e25b85c4239985d21333dd4f (diff) |
Fully GC unused parameter as we now always split phrases.
Diffstat (limited to 'searchcore/src')
6 files changed, 19 insertions, 60 deletions
diff --git a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp index 2ef8e3dcbb9..eb222518710 100644 --- a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp +++ b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp @@ -80,7 +80,7 @@ std::string dump_query(Node &root) { root.accept(dumper); } auto mem = buffer.obtain(); - return std::string(mem.data, mem.size); + return {mem.data, mem.size}; } namespace { @@ -258,22 +258,18 @@ std::string split_query_tree_dump = //----------------------------------------------------------------------------- -Node::UP optimize(Node::UP root, bool white_list, bool split) { - return UnpackingIteratorsOptimizer::optimize(std::move(root), white_list, split); +Node::UP optimize(Node::UP root, bool white_list) { + return UnpackingIteratorsOptimizer::optimize(std::move(root), white_list); } TEST(UnpackingIteratorsOptimizerTest, require_that_root_phrase_node_can_be_left_alone) { - std::string actual1 = dump_query(*optimize(make_phrase(), false, false)); - std::string actual2 = dump_query(*optimize(make_phrase(), false, true)); - std::string actual3 = dump_query(*optimize(make_phrase(), true, false)); + std::string actual1 = dump_query(*optimize(make_phrase(), false)); std::string expect = plain_phrase_dump; EXPECT_EQ(actual1, expect); - EXPECT_EQ(actual2, expect); - EXPECT_EQ(actual3, expect); } TEST(UnpackingIteratorsOptimizerTest, require_that_root_phrase_node_can_be_split) { - std::string actual1 = dump_query(*optimize(make_phrase(), true, true)); + std::string actual1 = dump_query(*optimize(make_phrase(), true)); std::string expect = split_phrase_dump; EXPECT_EQ(actual1, expect); } @@ -281,13 +277,9 @@ TEST(UnpackingIteratorsOptimizerTest, require_that_root_phrase_node_can_be_split //----------------------------------------------------------------------------- TEST(UnpackingIteratorsOptimizerTest, require_that_root_same_element_node_can_be_left_alone) { - std::string actual1 = dump_query(*optimize(make_same_element(), false, false)); - std::string actual2 = dump_query(*optimize(make_same_element(), false, true)); - std::string actual3 = dump_query(*optimize(make_same_element(), true, false)); + std::string actual1 = dump_query(*optimize(make_same_element(), false)); std::string expect = plain_same_element_dump; EXPECT_EQ(actual1, expect); - EXPECT_EQ(actual2, expect); - EXPECT_EQ(actual3, expect); } #if ENABLE_SAME_ELEMENT_SPLIT @@ -301,17 +293,9 @@ TEST(UnpackingIteratorsOptimizerTest, require_that_root_same_element_node_can_be //----------------------------------------------------------------------------- -TEST(UnpackingIteratorsOptimizerTest, require_that_query_tree_can_be_left_alone) { - std::string actual1 = dump_query(*optimize(make_query_tree(), false, false)); - std::string actual2 = dump_query(*optimize(make_query_tree(), true, false)); - std::string expect = plain_query_tree_dump; - EXPECT_EQ(actual1, expect); - EXPECT_EQ(actual2, expect); -} - TEST(UnpackingIteratorsOptimizerTest, require_that_query_tree_can_be_split) { - std::string actual1 = dump_query(*optimize(make_query_tree(), false, true)); - std::string actual2 = dump_query(*optimize(make_query_tree(), true, true)); + std::string actual1 = dump_query(*optimize(make_query_tree(), false)); + std::string actual2 = dump_query(*optimize(make_query_tree(), true)); std::string expect = split_query_tree_dump; EXPECT_EQ(actual1, expect); EXPECT_EQ(actual2, expect); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index c6f3e215329..7e7532a3182 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -193,7 +193,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter, trace.addEvent(4, "Start query setup"); _query.setWhiteListBlueprint(metaStore.createWhiteListBlueprint()); trace.addEvent(5, "Deserialize and build query tree"); - _valid = _query.buildTree(queryStack, location, viewResolver, indexEnv, true); + _valid = _query.buildTree(queryStack, location, viewResolver, indexEnv); if (_valid) { _query.extractTerms(_queryEnv.terms()); _query.extractLocations(_queryEnv.locations()); diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 00a3f6bab7e..d4f4ae8015d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -167,21 +167,13 @@ bool Query::buildTree(vespalib::stringref stack, const string &location, const ViewResolver &resolver, const IIndexEnvironment &indexEnv) { - return buildTree(stack, location, resolver, indexEnv, true); -} -bool -Query::buildTree(vespalib::stringref stack, const string &location, - const ViewResolver &resolver, const IIndexEnvironment &indexEnv, - bool split_unpacking_iterators) -{ SimpleQueryStackDumpIterator stack_dump_iterator(stack); _query_tree = QueryTreeCreator<ProtonNodeTypes>::create(stack_dump_iterator); if (_query_tree) { SameElementModifier prefixSameElementSubIndexes; _query_tree->accept(prefixSameElementSubIndexes); exchange_location_nodes(location, _query_tree, _locations); - _query_tree = UnpackingIteratorsOptimizer::optimize(std::move(_query_tree), - bool(_whiteListBlueprint), split_unpacking_iterators); + _query_tree = UnpackingIteratorsOptimizer::optimize(std::move(_query_tree), bool(_whiteListBlueprint)); ResolveViewVisitor resolve_visitor(resolver, indexEnv); _query_tree->accept(resolve_visitor); return true; diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index 1b5d6dbca60..b67672ec3ef 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -55,11 +55,6 @@ public: bool buildTree(vespalib::stringref stack, const vespalib::string &location, const ViewResolver &resolver, - const search::fef::IIndexEnvironment &idxEnv, - bool split_unpacking_iterators); - bool buildTree(vespalib::stringref stack, - const vespalib::string &location, - const ViewResolver &resolver, const search::fef::IIndexEnvironment &idxEnv); /** diff --git a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp index f9cdaaf7c15..e8dc8ab85ba 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp @@ -73,37 +73,27 @@ struct TermExpander : QueryVisitor { struct NodeTraverser : TemplateTermVisitor<NodeTraverser, ProtonNodeTypes> { - bool split_unpacking_iterators; - - NodeTraverser(bool split_unpacking_iterators_in) - : split_unpacking_iterators(split_unpacking_iterators_in) {} template <class TermNode> void visitTerm(TermNode &) {} void visit(ProtonNodeTypes::And &n) override { for (Node *child: n.getChildren()) { child->accept(*this); } - if (split_unpacking_iterators) { - TermExpander expander; - for (Node *child: n.getChildren()) { - child->accept(expander); - } - expander.flush(n); + TermExpander expander; + for (Node *child: n.getChildren()) { + child->accept(expander); } + expander.flush(n); } }; } // namespace proton::matching::<unnamed> search::query::Node::UP -UnpackingIteratorsOptimizer::optimize(search::query::Node::UP root, - bool has_white_list, - bool split_unpacking_iterators) +UnpackingIteratorsOptimizer::optimize(search::query::Node::UP root, bool has_white_list) { - if (split_unpacking_iterators) { - NodeTraverser traverser(split_unpacking_iterators); - root->accept(traverser); - } - if (has_white_list && split_unpacking_iterators) { + NodeTraverser traverser; + root->accept(traverser); + if (has_white_list) { TermExpander expander; root->accept(expander); if (!expander.terms.empty()) { diff --git a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.h b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.h index d8897f4da1e..f698b79dd0c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.h +++ b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.h @@ -12,9 +12,7 @@ namespace proton::matching { * expensive. **/ struct UnpackingIteratorsOptimizer { - static search::query::Node::UP optimize(search::query::Node::UP root, - bool has_white_list, - bool split_unpacking_iterators); + static search::query::Node::UP optimize(search::query::Node::UP root, bool has_white_list); }; } |