summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-17 14:22:16 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-11-17 14:22:16 +0000
commitd8cd6277df664aadb35f84dc3d78d6038b244539 (patch)
treea1a2fc866f4786c1f090f88e07ec3d59f8655526 /searchcore
parent3b2428cd74d5369dd74ff290cad4cfd2aef5567d (diff)
Use a pair as suggested in code review
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h3
2 files changed, 6 insertions, 5 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
index 497e0b36fc7..5d2269b87cb 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
@@ -76,7 +76,7 @@ toString(AttributeLimiter::DiversityCutoffStrategy strategy)
return (strategy == AttributeLimiter::DiversityCutoffStrategy::STRICT) ? STRICT_STR : LOOSE_STR;
}
-search::fef::MatchData &
+AttributeLimiter::BlueprintAndMatchData
AttributeLimiter::create_match_data(size_t want_hits, size_t max_group_size, double hit_rate, bool strictSearch) {
std::lock_guard<std::mutex> guard(_lock);
const uint32_t my_field_id = 0;
@@ -105,13 +105,13 @@ AttributeLimiter::create_match_data(size_t want_hits, size_t max_group_size, dou
_blueprint->freeze();
}
_match_datas.push_back(layout.createMatchData());
- return *_match_datas.back();
+ return {*_blueprint, *_match_datas.back()};
}
std::unique_ptr<SearchIterator>
AttributeLimiter::create_search(size_t want_hits, size_t max_group_size, double hit_rate, bool strictSearch) {
- search::fef::MatchData & matchData = create_match_data(want_hits, max_group_size, hit_rate, strictSearch);
- return _blueprint->createSearch(matchData, strictSearch);
+ auto bp_and_md = create_match_data(want_hits, max_group_size, hit_rate, strictSearch);
+ return bp_and_md.first.createSearch(bp_and_md.second, strictSearch);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
index 1f9a1cebd8b..a2c73b63bee 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
@@ -46,7 +46,8 @@ public:
ssize_t getEstimatedHits() const;
static DiversityCutoffStrategy toDiversityCutoffStrategy(vespalib::stringref strategy);
private:
- search::fef::MatchData & create_match_data(size_t want_hits, size_t max_group_size, double hit_rate, bool strictSearch);
+ using BlueprintAndMatchData = std::pair<search::queryeval::Blueprint &, search::fef::MatchData &>;
+ BlueprintAndMatchData create_match_data(size_t want_hits, size_t max_group_size, double hit_rate, bool strictSearch);
search::queryeval::Searchable & _searchable_attributes;
const search::queryeval::IRequestContext & _requestContext;
const RangeQueryLocator & _rangeQueryLocator;