From cd700875d174d8d12ea501f5ca71f2723307c65c Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 30 Sep 2019 17:10:30 +0000 Subject: Remove some more transport related stuff. --- .../src/tests/proton/docsummary/docsummary.cpp | 5 ++- .../src/tests/proton/matching/matching_test.cpp | 38 +++++++++------------- .../tests/proton/summaryengine/summaryengine.cpp | 4 +-- .../searchcore/proton/docsummary/docsumcontext.cpp | 4 +-- .../vespa/searchcore/proton/matching/matcher.cpp | 2 +- .../proton/matching/result_processor.cpp | 6 ++-- .../searchcore/proton/matching/result_processor.h | 4 +-- 7 files changed, 25 insertions(+), 38 deletions(-) (limited to 'searchcore') diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 0a9f3127844..0e521e473ae 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -359,7 +358,7 @@ Test::assertTensor(const Tensor::UP & exp, const std::string & fieldName, uint32_t classId; ASSERT_LESS_EQUAL(sizeof(classId), docsum.data.size()); memcpy(&classId, docsum.data.c_str(), sizeof(classId)); - ASSERT_EQUAL(::search::fs4transport::SLIME_MAGIC_ID, classId); + ASSERT_EQUAL(::search::docsummary::SLIME_MAGIC_ID, classId); vespalib::Slime slime; vespalib::Memory serialized(docsum.data.c_str() + sizeof(classId), docsum.data.size() - sizeof(classId)); @@ -384,7 +383,7 @@ getSlime(const DocsumReply &reply, uint32_t id, bool relaxed) uint32_t classId; ASSERT_LESS_EQUAL(sizeof(classId), docsum.data.size()); memcpy(&classId, docsum.data.c_str(), sizeof(classId)); - ASSERT_EQUAL(::search::fs4transport::SLIME_MAGIC_ID, classId); + ASSERT_EQUAL(search::docsummary::SLIME_MAGIC_ID, classId); vespalib::Slime slime; vespalib::Memory serialized(docsum.data.c_str() + sizeof(classId), docsum.data.size() - sizeof(classId)); diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 3f68b54aca2..950321533b0 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -573,27 +572,22 @@ TEST("require that re-ranking is diverse with diversity = 1/10") { } TEST("require that sortspec can be used (multi-threaded)") { - 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("id:ns:searchdocument::100").getGlobalId(), reply->hits[0].gid); - EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric); - EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::200").getGlobalId(), reply->hits[1].gid); - EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric); - EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::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()); - } + 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("id:ns:searchdocument::100").getGlobalId(), reply->hits[0].gid); + EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric); + EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::200").getGlobalId(), reply->hits[1].gid); + EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric); + EXPECT_EQUAL(document::DocumentId("id:ns:searchdocument::300").getGlobalId(), reply->hits[2].gid); + EXPECT_EQUAL(zero_rank_value, reply->hits[2].metric); + EXPECT_FALSE(reply->sortIndex.empty()); + EXPECT_FALSE(reply->sortData.empty()); } } diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index 23ef86a46b7..a9cae7d8ab7 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include @@ -336,7 +336,7 @@ void createSummary(search::RawBuf &buf) { vespalib::Slime summary; summary.setObject().setLong("long", 982); - uint32_t magic = search::fs4transport::SLIME_MAGIC_ID; + uint32_t magic = search::docsummary::SLIME_MAGIC_ID; buf.append(&magic, sizeof(magic)); search::SlimeOutputRawBufAdapter adapter(buf); BinaryFormat::encode(summary, adapter); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp index c65257e7f6a..5951d07a2cb 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -50,7 +49,6 @@ DocsumContext::initState() { const DocsumRequest & req = _request; _docsumState._args.initFromDocsumRequest(req); - _docsumState._args.SetQueryFlags(req.queryFlags & ~search::fs4transport::QFLAG_DROP_SORTDATA); _docsumState._docsumcnt = req.hits.size(); _docsumState._docsumbuf = (_docsumState._docsumcnt > 0) @@ -176,7 +174,7 @@ DocsumContext::FillRankFeatures(search::docsummary::GetDocsumsState * state, sea { assert(&_docsumState == state); // check if we are allowed to run - if ((state->_args.GetQueryFlags() & search::fs4transport::QFLAG_DUMP_FEATURES) == 0) { + if ( ! state->_args.dumpFeatures()) { return; } state->_rankFeatures = _matcher->getRankFeatures(_request, _searchCtx, _attrCtx, _sessionMgr); diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 596635a416a..87c0283d228 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -224,7 +224,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl !_rankSetup->getSecondPhaseRank().empty(), !willNotNeedRanking(request, groupingContext)); ResultProcessor rp(attrContext, metaStore, sessionMgr, groupingContext, sessionId, - request.sortSpec, params.offset, params.hits, request.should_drop_sort_data()); + request.sortSpec, params.offset, params.hits); size_t numThreadsPerSearch = computeNumThreadsPerSearch(mtf->estimate(), rankProperties); LimitedThreadBundleWrapper limitedThreadBundle(threadBundle, numThreadsPerSearch); diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp index dedda1504a5..445aab310d9 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp @@ -61,8 +61,7 @@ ResultProcessor::ResultProcessor(IAttributeContext &attrContext, GroupingContext &groupingContext, const vespalib::string &sessionId, const vespalib::string &sortSpec, - size_t offset, size_t hits, - bool drop_sort_data) + size_t offset, size_t hits) : _attrContext(attrContext), _metaStore(metaStore), _sessionMgr(sessionMgr), @@ -71,7 +70,6 @@ ResultProcessor::ResultProcessor(IAttributeContext &attrContext, _sortSpec(sortSpec), _offset(offset), _hits(hits), - _drop_sort_data(drop_sort_data), _wasMerged(false) { if (!_groupingContext.empty()) { @@ -140,7 +138,7 @@ ResultProcessor::makeReply(PartialResultUP full_result) dst.metric = src._rankValue; LOG(debug, "convertLidToGid: hit[%zu]: lid(%u) -> gid(%s)", i, docId, dst.gid.toString().c_str()); } - if (result.hasSortData() && (hitcnt > 0) && !_drop_sort_data) { + if (result.hasSortData() && (hitcnt > 0)) { size_t sortDataSize = result.sortDataSize(); for (size_t i = 0; i < hitOffset; ++i) { sortDataSize -= result.sortData(i).second; diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h index 41c764d247b..48a8aecebe1 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h @@ -88,7 +88,6 @@ private: const vespalib::string &_sortSpec; size_t _offset; size_t _hits; - bool _drop_sort_data; bool _wasMerged; public: @@ -98,8 +97,7 @@ public: GroupingContext & groupingContext, const vespalib::string & sessionId, const vespalib::string & sortSpec, - size_t offset, size_t hits, - bool drop_sort_data); + size_t offset, size_t hits); ~ResultProcessor(); size_t countFS4Hits(); -- cgit v1.2.3