summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp24
-rw-r--r--searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp3
7 files changed, 43 insertions, 3 deletions
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index 432a17392e5..a09437be46b 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -120,6 +120,7 @@ class Test : public vespalib::TestApp {
void requireThatSameElementTermsAreProperlyPrefixed();
void requireThatSameElementDoesNotAllocateMatchData();
void requireThatSameElementIteratorsCanBeBuilt();
+ void requireThatConstBoolBlueprintsAreCreatedCorrectly();
public:
~Test() override;
@@ -1088,6 +1089,28 @@ Test::requireThatSameElementIteratorsCanBeBuilt() {
EXPECT_TRUE(iterator->seek(8));
}
+void Test::requireThatConstBoolBlueprintsAreCreatedCorrectly() {
+ using search::queryeval::AlwaysTrueBlueprint;
+ using search::queryeval::EmptyBlueprint;
+
+ ProtonTrue true_node;
+ ProtonFalse false_node;
+
+ FakeRequestContext requestContext;
+ FakeSearchContext context;
+ context.setLimit(1000);
+ context.addIdx(0).idx(0).getFake()
+ .addResult(field, "foo", FakeResult().doc(1).doc(3));
+
+ Blueprint::UP t_blueprint = BlueprintBuilder::build(requestContext, true_node, context);
+ auto *tbp = dynamic_cast<AlwaysTrueBlueprint*>(t_blueprint.get());
+ EXPECT_TRUE(tbp != nullptr);
+
+ Blueprint::UP f_blueprint = BlueprintBuilder::build(requestContext, false_node, context);
+ auto *fbp = dynamic_cast<EmptyBlueprint*>(f_blueprint.get());
+ EXPECT_TRUE(fbp != nullptr);
+}
+
Test::~Test() = default;
int
@@ -1126,6 +1149,7 @@ Test::Main()
TEST_CALL(requireThatSameElementTermsAreProperlyPrefixed);
TEST_CALL(requireThatSameElementDoesNotAllocateMatchData);
TEST_CALL(requireThatSameElementIteratorsCanBeBuilt);
+ TEST_CALL(requireThatConstBoolBlueprintsAreCreatedCorrectly);
TEST_DONE();
}
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 5dc9808a5b6..ffd08b3bbef 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
@@ -67,6 +67,8 @@ struct DumpQuery : QueryVisitor {
void visit(PredicateQuery &) override {}
void visit(RegExpTerm &) override {}
void visit(NearestNeighborTerm &) override {}
+ void visit(TrueQueryNode &) override {}
+ void visit(FalseQueryNode &) override {}
};
std::string dump_query(Node &root) {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
index 0d640f2a599..9be5920c0ed 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
@@ -144,7 +144,6 @@ protected:
void visit(ProtonONear &n) override { buildIntermediate(new ONearBlueprint(n.getDistance()), n); }
void visit(ProtonSameElement &n) override { buildSameElement(n); }
-
void visit(ProtonWeightedSetTerm &n) override { buildTerm(n); }
void visit(ProtonDotProduct &n) override { buildTerm(n); }
void visit(ProtonWandTerm &n) override { buildTerm(n); }
@@ -160,6 +159,12 @@ protected:
void visit(ProtonPredicateQuery &n) override { buildTerm(n); }
void visit(ProtonRegExpTerm &n) override { buildTerm(n); }
void visit(ProtonNearestNeighborTerm &n) override { buildTerm(n); }
+ void visit(ProtonTrue &) override {
+ _result = std::make_unique<AlwaysTrueBlueprint>();
+ }
+ void visit(ProtonFalse &) override {
+ _result = std::make_unique<EmptyBlueprint>();
+ }
public:
BlueprintBuilderVisitor(const IRequestContext & requestContext, ISearchContext &context) :
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
index 2ebd52d7fa7..e7817dcecd2 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
@@ -114,7 +114,8 @@ typedef search::query::SimpleOr ProtonOr;
typedef search::query::SimpleRank ProtonRank;
typedef search::query::SimpleWeakAnd ProtonWeakAnd;
typedef search::query::SimpleSameElement ProtonSameElement;
-
+typedef search::query::SimpleTrue ProtonTrue;
+typedef search::query::SimpleFalse ProtonFalse;
struct ProtonEquiv final : public ProtonTermBase<search::query::Equiv> {
search::fef::MatchDataLayout children_mdl;
@@ -161,6 +162,8 @@ struct ProtonNodeTypes {
typedef ProtonPredicateQuery PredicateQuery;
typedef ProtonRegExpTerm RegExpTerm;
typedef ProtonNearestNeighborTerm NearestNeighborTerm;
+ typedef ProtonTrue TrueQueryNode;
+ typedef ProtonFalse FalseQueryNode;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp b/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp
index a3722c1e3b9..34cb5369c1e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp
@@ -51,7 +51,6 @@ public:
void visit(ProtonRank &) override {}
void visit(ProtonWeakAnd &) override {}
void visit(ProtonSameElement &) override {}
-
void visit(ProtonWeightedSetTerm &) override {}
void visit(ProtonDotProduct &) override {}
void visit(ProtonWandTerm &) override {}
@@ -68,6 +67,8 @@ public:
void visit(ProtonPredicateQuery &) override {}
void visit(ProtonRegExpTerm &n) override { visitTerm(n); }
void visit(ProtonNearestNeighborTerm &) override {}
+ void visit(ProtonTrue &) override {}
+ void visit(ProtonFalse &) override {}
};
} // namespace proton::matching::<unnamed>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp
index 08ec0e767db..c2abeaa36ee 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp
@@ -26,6 +26,8 @@ struct TermDataFromTermVisitor
void visit(ProtonRank &) override {}
void visit(ProtonWeakAnd &) override {}
void visit(ProtonSameElement &) override { }
+ void visit(ProtonTrue &) override {}
+ void visit(ProtonFalse &) override {}
void visit(ProtonWeightedSetTerm &n) override { visitTerm(n); }
void visit(ProtonDotProduct &n) override { visitTerm(n); }
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 eada88010dd..d60bc53aa57 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp
@@ -57,6 +57,9 @@ struct TermExpander : QueryVisitor {
void visit(PredicateQuery &) override {}
void visit(RegExpTerm &) override {}
void visit(NearestNeighborTerm &) override {}
+ void visit(TrueQueryNode &) override {}
+ void visit(FalseQueryNode &) override {}
+
void flush(Intermediate &parent) {
for (Node::UP &term: terms) {
parent.append(std::move(term));