aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_params.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h2
5 files changed, 15 insertions, 9 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 679108ba872..fefc6f361a9 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -494,11 +494,11 @@ TEST("require that sortspec can be used (multi-threaded)") {
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(default_rank_value, reply->hits[0].metric);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[0].metric);
EXPECT_EQUAL(document::DocumentId("doc::200").getGlobalId(), reply->hits[1].gid);
- EXPECT_EQUAL(default_rank_value, reply->hits[1].metric);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[1].metric);
EXPECT_EQUAL(document::DocumentId("doc::300").getGlobalId(), reply->hits[2].gid);
- EXPECT_EQUAL(default_rank_value, reply->hits[2].metric);
+ EXPECT_EQUAL(zero_rank_value, reply->hits[2].metric);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_params.h b/searchcore/src/vespa/searchcore/proton/matching/match_params.h
index 1426f942dfd..50787516144 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_params.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_params.h
@@ -27,6 +27,7 @@ struct MatchParams {
uint32_t hits_in,
bool hasFinalRank,
bool needRanking=true);
+ bool save_rank_scores() const { return ((heapSize + arraySize) != 0); }
};
} // namespace proton::matching
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 1d5abcc2929..3a9f59680f9 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -250,7 +250,7 @@ MatchThread::findMatches(MatchTools &matchTools)
LOG(debug, "SearchIterator after MultiBitVectorIteratorBase::optimize(): %s", search->asString().c_str());
}
HitCollector hits(matchParams.numDocs, matchParams.arraySize, matchParams.heapSize);
- if (matchTools.has_first_phase_rank() && ((matchParams.arraySize + matchParams.heapSize) != 0)) {
+ if (match_with_ranking) {
match_loop_helper<SearchIterator::UP, true>(matchTools, std::move(search), *ranking, hits);
} else {
if ((dynamic_cast<const OptimizedAndNotForBlackListing *>(search.get()) != 0) &&
@@ -283,7 +283,7 @@ MatchThread::findMatches(MatchTools &matchTools)
hits.setRanges(ranges);
}
}
- return hits.getResultSet();
+ return hits.getResultSet(fallback_rank_value());
}
void
@@ -294,7 +294,7 @@ MatchThread::processResult(const Doom & hardDoom,
if (hardDoom.doom()) return;
bool hasGrouping = (context.grouping.get() != 0);
if (context.sort->hasSortData() || hasGrouping) {
- result->mergeWithBitOverflow();
+ result->mergeWithBitOverflow(fallback_rank_value());
}
if (hardDoom.doom()) return;
size_t totalHits = result->getNumHits();
@@ -369,7 +369,8 @@ MatchThread::MatchThread(size_t thread_id_in,
thread_stats(),
total_time_s(0.0),
match_time_s(0.0),
- wait_time_s(0.0)
+ wait_time_s(0.0),
+ match_with_ranking(mtf.has_first_phase_rank() && mp.save_rank_scores())
{
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index 2d056d0e761..a279e83f032 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -47,13 +47,14 @@ private:
double total_time_s;
double match_time_s;
double wait_time_s;
+ bool match_with_ranking;
class Context {
public:
Context(double rankDropLimit, MatchTools &matchTools, RankProgram & ranking, HitCollector & hits,
uint32_t num_threads) __attribute__((noinline));
void rankHit(uint32_t docId);
- void addHit(uint32_t docId) { _hits.addHit(docId, search::default_rank_value); }
+ void addHit(uint32_t docId) { _hits.addHit(docId, search::zero_rank_value); }
bool isBelowLimit() const { return matches < _matches_limit; }
bool isAtLimit() const { return matches == _matches_limit; }
bool atSoftDoom() const { return _softDoom.doom(); }
@@ -94,6 +95,9 @@ private:
void processResult(const Doom & hardDoom, search::ResultSet::UP result, ResultProcessor::Context &context);
bool isFirstThread() const { return thread_id == 0; }
+
+ search::HitRank fallback_rank_value() const { return match_with_ranking ? search::default_rank_value : search::zero_rank_value; }
+
public:
MatchThread(size_t thread_id_in,
size_t num_threads_in,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index 1c0d9aff497..b4f1f997d32 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -55,7 +55,6 @@ public:
createSearch(search::fef::MatchData &matchData) const {
return _query.createSearch(matchData);
}
- bool has_first_phase_rank() const { return !_rankSetup.getFirstPhaseRank().empty(); }
bool has_second_phase_rank() const { return !_rankSetup.getSecondPhaseRank().empty(); }
search::fef::RankProgram::UP first_phase_program() const;
search::fef::RankProgram::UP second_phase_program() const;
@@ -97,6 +96,7 @@ public:
const MaybeMatchPhaseLimiter &match_limiter() const { return *_match_limiter; }
MatchTools::UP createMatchTools() const;
search::queryeval::Blueprint::HitEstimate estimate() const { return _query.estimate(); }
+ bool has_first_phase_rank() const { return !_rankSetup.getFirstPhaseRank().empty(); }
};
}