summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2018-04-11 13:25:46 +0000
committerHåvard Pettersen <havardpe@oath.com>2018-04-11 13:25:46 +0000
commit1b1dbcc9ff7471bfd26acb7b5d399c934c1e26f8 (patch)
treefff4a8573553c2d0a3df4ade0b9dd61d460615c0 /searchcore/src/tests/proton/matching
parent4e9d72eb912c972dd8f8fbe1e80ffaec7cbc73aa (diff)
allow proton to drop sort data when sending query results
Diffstat (limited to 'searchcore/src/tests/proton/matching')
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 27e677bb1dc..62c61406f67 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/searchlib/aggregation/perdocexpression.h>
#include <vespa/searchlib/attribute/extendableattributes.h>
#include <vespa/searchlib/common/featureset.h>
+#include <vespa/searchlib/common/transport.h>
#include <vespa/searchlib/engine/docsumrequest.h>
#include <vespa/searchlib/engine/searchrequest.h>
#include <vespa/searchlib/engine/docsumreply.h>
@@ -485,20 +486,27 @@ TEST("require that re-ranking is performed (multi-threaded)") {
}
TEST("require that sortspec can be used (multi-threaded)") {
- for (size_t threads = 1; threads <= 16; ++threads) {
- MyWorld world;
- world.basicSetup();
- world.basicResults();
- SearchRequest::SP request = world.createSimpleRequest("f1", "spread");
- request->sortSpec = "+a1";
- SearchReply::UP reply = world.performSearch(request, threads);
- ASSERT_EQUAL(9u, reply->hits.size());
- EXPECT_EQUAL(document::DocumentId("doc::100").getGlobalId(), reply->hits[0].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric);
- EXPECT_EQUAL(document::DocumentId("doc::200").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric);
- EXPECT_EQUAL(document::DocumentId("doc::300").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(zero_rank_value, reply->hits[2].metric);
+ for (bool drop_sort_data: {false, true}) {
+ for (size_t threads = 1; threads <= 16; ++threads) {
+ MyWorld world;
+ world.basicSetup();
+ world.basicResults();
+ SearchRequest::SP request = world.createSimpleRequest("f1", "spread");
+ request->sortSpec = "+a1";
+ if (drop_sort_data) {
+ request->queryFlags |= fs4transport::QFLAG_DROP_SORTDATA;
+ }
+ SearchReply::UP reply = world.performSearch(request, threads);
+ ASSERT_EQUAL(9u, reply->hits.size());
+ EXPECT_EQUAL(document::DocumentId("doc::100").getGlobalId(), reply->hits[0].gid);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric);
+ EXPECT_EQUAL(document::DocumentId("doc::200").getGlobalId(), reply->hits[1].gid);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric);
+ EXPECT_EQUAL(document::DocumentId("doc::300").getGlobalId(), reply->hits[2].gid);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[2].metric);
+ EXPECT_EQUAL(drop_sort_data, reply->sortIndex.empty());
+ EXPECT_EQUAL(drop_sort_data, reply->sortData.empty());
+ }
}
}