summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-17 15:42:15 +0100
committerGitHub <noreply@github.com>2023-11-17 15:42:15 +0100
commit27a28202d1436885aa76dd01a71151df540cdc0a (patch)
treeda2476b0ae277f3008ead317ad1694ade55c6d34 /searchcore
parentb0ff93e170cdd38f1bc1b38b756a428c4e0726ca (diff)
parentc17330816012cbf496723bbf88333e7e9b361c0a (diff)
Merge pull request #29369 from vespa-engine/balder/gc-unused-split-parameter
Fully GC unused parameter as we now always split phrases.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp32
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp26
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.h4
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);
};
}