aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-03 11:51:34 +0200
committerGitHub <noreply@github.com>2023-07-03 11:51:34 +0200
commite02a187ae0951b3ee506ea930080b7b67a857df2 (patch)
treef5d9a410ae22a8c95665428d53b30434918a80de
parent20fa703e4a6b584155a6eef2b870461979228d16 (diff)
parent17939b9d41278d9e2a6133a8d644d869a74ee27d (diff)
Merge pull request #27602 from vespa-engine/balder/compute-rank-if-using-rank-score-drop-limit
Do not drop rank if rank-score-drop-limit has been specified explicit.
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index b1e9f3fec3a..26cf9901f57 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -73,9 +73,9 @@ numThreads(size_t hits, size_t minHits) {
class LimitedThreadBundleWrapper final : public vespalib::ThreadBundle
{
public:
- LimitedThreadBundleWrapper(vespalib::ThreadBundle &threadBundle, uint32_t maxThreads) :
- _threadBundle(threadBundle),
- _maxThreads(std::min(maxThreads, static_cast<uint32_t>(threadBundle.size())))
+ LimitedThreadBundleWrapper(vespalib::ThreadBundle &threadBundle, uint32_t maxThreads)
+ : _threadBundle(threadBundle),
+ _maxThreads(std::min(maxThreads, static_cast<uint32_t>(threadBundle.size())))
{ }
size_t size() const override { return _maxThreads; }
void run(vespalib::Runnable* const* targets, size_t cnt) override {
@@ -87,9 +87,13 @@ private:
};
bool
-willNeedRanking(const SearchRequest & request, const GroupingContext & groupingContext) {
+willNeedRanking(const SearchRequest & request, const GroupingContext & groupingContext,
+ search::feature_t rank_score_drop_limit)
+{
return (groupingContext.needRanking() || (request.maxhits != 0))
- && (request.sortSpec.empty() || (request.sortSpec.find("[rank]") != vespalib::string::npos));
+ && (request.sortSpec.empty() ||
+ (request.sortSpec.find("[rank]") != vespalib::string::npos) ||
+ !std::isnan(rank_score_drop_limit));
}
SearchReply::UP
@@ -279,7 +283,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
MatchParams params(searchContext.getDocIdLimit(), heapSize, arraySize, rank_score_drop_limit,
request.offset, request.maxhits, !_rankSetup->getSecondPhaseRank().empty(),
- willNeedRanking(request, groupingContext));
+ willNeedRanking(request, groupingContext, rank_score_drop_limit));
ResultProcessor rp(attrContext, metaStore, sessionMgr, groupingContext, sessionId,
request.sortSpec, params.offset, params.hits);