summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching/query_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-07-24 09:09:20 +0200
committerHenning Baldersheim <balder@oath.com>2018-07-24 09:09:20 +0200
commit9933dd135928b850267f78c2250be35a7969f0d6 (patch)
tree471702f44787cd66cd7c69bc217bd9559697a977 /searchcore/src/tests/proton/matching/query_test.cpp
parent611d541bb06a168848371ab36959201cd5e766c5 (diff)
Move the whitelist down through AndNot and Rank to the last one and 'AND' it with the first child there.
Diffstat (limited to 'searchcore/src/tests/proton/matching/query_test.cpp')
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index b80fba86796..82aab72068d 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -887,10 +887,11 @@ Test::requireThatWhiteListBlueprintCanBeUsed()
EXPECT_EQUAL(exp, act);
}
-template<typename T>
+template<typename T1, typename T2>
void verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing(QueryBuilder<ProtonNodeTypes> & builder) {
builder.addStringTerm("foo", field, field_id, string_weight);
builder.addStringTerm("bar", field, field_id, string_weight);
+ builder.addStringTerm("baz", field, field_id, string_weight);
std::string stackDump = StackDumpCreator::create(*builder.build());
Query query;
query.buildTree(stackDump, "", ViewResolver(), plain_index_env);
@@ -904,27 +905,33 @@ void verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing(QueryBuilder<Pr
FakeRequestContext requestContext;
MatchDataLayout mdl;
query.reserveHandles(requestContext, context, mdl);
- const IntermediateBlueprint * root = dynamic_cast<const T *>(query.peekRoot());
+ const IntermediateBlueprint * root = dynamic_cast<const T1 *>(query.peekRoot());
ASSERT_TRUE(root != nullptr);
EXPECT_EQUAL(2u, root->childCnt());
- const AndBlueprint * first = dynamic_cast<const AndBlueprint *>(&root->getChild(0));
+ const IntermediateBlueprint * second = dynamic_cast<const T2 *>(&root->getChild(0));
+ ASSERT_TRUE(second != nullptr);
+ EXPECT_EQUAL(2u, second->childCnt());
+ const AndBlueprint * first = dynamic_cast<const AndBlueprint *>(&second->getChild(0));
ASSERT_TRUE(first != nullptr);
EXPECT_EQUAL(2u, first->childCnt());
EXPECT_TRUE(dynamic_cast<const SourceBlenderBlueprint *>(&first->getChild(0)));
EXPECT_TRUE(dynamic_cast<const SimpleBlueprint *>(&first->getChild(1)));
+ EXPECT_TRUE(dynamic_cast<const SourceBlenderBlueprint *>(&second->getChild(1)));
EXPECT_TRUE(dynamic_cast<const SourceBlenderBlueprint *>(&root->getChild(1)));
}
void Test::requireThatRankBlueprintStaysOnTopAfterWhiteListing() {
QueryBuilder<ProtonNodeTypes> builder;
builder.addRank(2);
- verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing<RankBlueprint>(builder);
+ builder.addAndNot(2);
+ verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing<RankBlueprint, AndNotBlueprint>(builder);
}
void Test::requireThatAndNotBlueprintStaysOnTopAfterWhiteListing() {
QueryBuilder<ProtonNodeTypes> builder;
builder.addAndNot(2);
- verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing<AndNotBlueprint>(builder);
+ builder.addRank(2);
+ verifyThatRankBlueprintAndAndNotStaysOnTopAfterWhiteListing<AndNotBlueprint, RankBlueprint>(builder);
}