summaryrefslogtreecommitdiffstats
path: root/streamingvisitors
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-02-15 08:33:25 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2024-02-15 08:44:55 +0000
commit00b5d8ce69c9ea8d7d5a85f32aa40dd69c674948 (patch)
treed462dfa58ac1732104da8ce99cff1c7ec6a309f9 /streamingvisitors
parentcabfde007cf5d48a36249e01ea672559714d72a7 (diff)
Handle rank-score-drop-limit overrides in the query too.
Diffstat (limited to 'streamingvisitors')
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp20
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.h11
2 files changed, 18 insertions, 13 deletions
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 28a2a521cf7..1875664f6c4 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -659,11 +659,12 @@ SearchVisitor::RankController::processAccessedAttributes(const QueryEnvironment
SearchVisitor::RankController::RankController()
: _rankProfile("default"),
_rankManagerSnapshot(nullptr),
- _rankSetup(nullptr),
- _queryProperties(),
- _featureOverrides(),
+ _rank_score_drop_limit(std::numeric_limits<search::feature_t>::min()),
_hasRanking(false),
+ _hasSummaryFeatures(false),
_dumpFeatures(false),
+ _queryProperties(),
+ _featureOverrides(),
_rankProcessor(),
_dumpProcessor()
{ }
@@ -677,7 +678,9 @@ SearchVisitor::RankController::setupRankProcessors(Query & query,
const search::IAttributeManager & attrMan,
std::vector<AttrInfo> & attributeFields)
{
- _rankSetup = &_rankManagerSnapshot->getRankSetup(_rankProfile);
+ using RankScoreDropLimit = search::fef::indexproperties::hitcollector::RankScoreDropLimit;
+ const search::fef::RankSetup & rankSetup = _rankManagerSnapshot->getRankSetup(_rankProfile);
+ _rank_score_drop_limit = RankScoreDropLimit::lookup(_queryProperties, rankSetup.getRankScoreDropLimit());
_rankProcessor = std::make_unique<RankProcessor>(_rankManagerSnapshot, _rankProfile, query, location, _queryProperties, _featureOverrides, &attrMan);
_rankProcessor->initForRanking(wantedHitCount, use_sort_blob);
// register attribute vectors needed for ranking
@@ -692,6 +695,7 @@ SearchVisitor::RankController::setupRankProcessors(Query & query,
}
_hasRanking = true;
+ _hasSummaryFeatures = ! rankSetup.getSummaryFeatures().empty();
}
@@ -723,7 +727,7 @@ bool
SearchVisitor::RankController::keepMatchedDocument()
{
// also make sure that NaN scores are added
- return (!(_rankProcessor->getRankScore() <= _rankSetup->getRankScoreDropLimit()));
+ return (!(_rankProcessor->getRankScore() <= _rank_score_drop_limit));
}
void
@@ -756,7 +760,7 @@ SearchVisitor::RankController::collectMatchedDocument(bool hasSorting,
vespalib::FeatureSet::SP
SearchVisitor::RankController::getFeatureSet(search::DocumentIdT docId) {
- if (_hasRanking && !_rankSetup->getSummaryFeatures().empty()) {
+ if (_hasRanking && _hasSummaryFeatures) {
return _rankProcessor->calculateFeatureSet(docId);
}
return {};
@@ -770,7 +774,7 @@ SearchVisitor::RankController::onCompletedVisiting(vsm::GetDocsumsStateCallback
_rankProcessor->fillSearchResult(searchResult);
// calculate summary features and set them on the callback object
- if (!_rankSetup->getSummaryFeatures().empty()) {
+ if (_hasSummaryFeatures) {
LOG(debug, "Calculate summary features");
docsumsStateCallback.setSummaryFeatures(_rankProcessor->calculateFeatureSet());
}
@@ -1099,7 +1103,7 @@ SearchVisitor::handleDocument(StorageDocument::SP documentSP)
} else {
_hitsRejectedCount++;
LOG(debug, "Do not keep document with id '%s' because rank score (%f) <= rank score drop limit (%f)",
- documentId.c_str(), rp.getRankScore(), _rankController.getRankSetup()->getRankScoreDropLimit());
+ documentId.c_str(), rp.getRankScore(), _rankController.rank_score_drop_limit());
}
} else {
LOG(debug, "Did not match document with id '%s'", document.docDoc().getId().getScheme().toString().c_str());
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
index 33d5a14084f..567cb1b1f2f 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
@@ -127,11 +127,12 @@ private:
private:
vespalib::string _rankProfile;
std::shared_ptr<const RankManager::Snapshot> _rankManagerSnapshot;
- const search::fef::RankSetup * _rankSetup;
- search::fef::Properties _queryProperties;
- search::fef::Properties _featureOverrides;
+ search::feature_t _rank_score_drop_limit;
bool _hasRanking;
+ bool _hasSummaryFeatures;
bool _dumpFeatures;
+ search::fef::Properties _queryProperties;
+ search::fef::Properties _featureOverrides;
RankProcessor::UP _rankProcessor;
RankProcessor::UP _dumpProcessor;
@@ -147,7 +148,7 @@ private:
public:
RankController();
~RankController();
- bool valid() const { return _rankProcessor.get() != nullptr; }
+ bool valid() const { return bool(_rankProcessor); }
void setRankProfile(const vespalib::string &rankProfile) { _rankProfile = rankProfile; }
const vespalib::string &getRankProfile() const { return _rankProfile; }
void setRankManagerSnapshot(const std::shared_ptr<const RankManager::Snapshot>& snapshot) { _rankManagerSnapshot = snapshot; }
@@ -156,7 +157,7 @@ private:
RankProcessor * getRankProcessor() { return _rankProcessor.get(); }
void setDumpFeatures(bool dumpFeatures) { _dumpFeatures = dumpFeatures; }
bool getDumpFeatures() const { return _dumpFeatures; }
- const search::fef::RankSetup * getRankSetup() const { return _rankSetup; }
+ search::feature_t rank_score_drop_limit() const noexcept { return _rank_score_drop_limit; }
/**
* Setup rank processors used for ranking and dumping.