diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-05-22 08:21:33 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-05-22 08:21:33 +0000 |
commit | b250914db9c6c54e6d6f4178e152ab5076838cb4 (patch) | |
tree | bae6be6ebdb5982b411a89bababe3d4d41a89141 /searchlib | |
parent | f90d55344d3489b857df685e3ce046a71c754198 (diff) |
Split ParallellWandMatchParams in 2.
Diffstat (limited to 'searchlib')
4 files changed, 36 insertions, 26 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp index 412a5973ad8..c02990c5921 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp @@ -254,8 +254,8 @@ create_op_filter(const Blueprint::Children &children, bool strict, Blueprint::Fi MultiSearch::Children list; std::unique_ptr<SearchIterator> spare; list.reserve(children.size()); - for (size_t i = 0; i < children.size(); ++i) { - auto filter = children[i]->createFilterSearch(constraint); + for (const auto & child : children) { + auto filter = child->createFilterSearch(constraint); auto matches_any = filter->matches_any(); if (should_short_circuit<Op>(matches_any)) { return filter; @@ -623,9 +623,9 @@ IntermediateBlueprint::sort(InFlow in_flow) sort(_children, in_flow); } auto flow = my_flow(in_flow); - for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->sort(InFlow(flow.strict(), flow.flow())); - flow.add(_children[i]->estimate()); + for (const auto & child : _children) { + child->sort(InFlow(flow.strict(), flow.flow())); + flow.add(child->estimate()); } } @@ -644,8 +644,8 @@ IntermediateBlueprint::createSearch(fef::MatchData &md) const { MultiSearch::Children subSearches; subSearches.reserve(_children.size()); - for (size_t i = 0; i < _children.size(); ++i) { - subSearches.push_back(_children[i]->createSearch(md)); + for (const auto & child : _children) { + subSearches.push_back(child->createSearch(md)); } return createIntermediateSearch(std::move(subSearches), md); } @@ -693,18 +693,17 @@ void IntermediateBlueprint::fetchPostings(const ExecuteInfo &execInfo) { auto flow = my_flow(InFlow(strict(), execInfo.hit_rate())); - for (size_t i = 0; i < _children.size(); ++i) { + for (const auto & child : _children) { double nextHitRate = flow.flow(); - Blueprint & child = *_children[i]; - child.fetchPostings(ExecuteInfo::create(nextHitRate, execInfo)); - flow.add(child.estimate()); + child->fetchPostings(ExecuteInfo::create(nextHitRate, execInfo)); + flow.add(child->estimate()); } } void IntermediateBlueprint::freeze() { - for (Blueprint::UP &child: _children) { + for (auto &child: _children) { child->freeze(); } freeze_self(); diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp index 5b8fa79b8af..532b9b7cede 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp @@ -26,7 +26,7 @@ size_t lookup_create_source(std::vector<std::unique_ptr<CombineType> > &sources, return i; } } - sources.push_back(std::unique_ptr<CombineType>(new CombineType())); + sources.push_back(std::make_unique<CombineType>()); sources.back()->setSourceId(child_source); sources.back()->setDocIdLimit(docid_limit); return (sources.size() - 1); diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h index bd173ab41eb..d40ba6b1a63 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.h @@ -20,21 +20,16 @@ struct ParallelWeakAndSearch : public SearchIterator /** * Params used to tweak the behavior of the WAND algorithm. */ - struct MatchParams + struct MatchParams : wand::MatchParams { - WeakAndHeap &scores; - score_t scoreThreshold; double thresholdBoostFactor; - uint32_t scoresAdjustFrequency; docid_t docIdLimit; - MatchParams(WeakAndHeap &scores_, - score_t scoreThreshold_, - double thresholdBoostFactor_, - uint32_t scoresAdjustFrequency_) - : scores(scores_), - scoreThreshold(scoreThreshold_), - thresholdBoostFactor(thresholdBoostFactor_), - scoresAdjustFrequency(scoresAdjustFrequency_), + MatchParams(WeakAndHeap &scores_in, + score_t scoreThreshold_in, + double thresholdBoostFactor_in, + uint32_t scoresAdjustFrequency_in) noexcept + : wand::MatchParams(scores_in, scoreThreshold_in, scoresAdjustFrequency_in), + thresholdBoostFactor(thresholdBoostFactor_in), docIdLimit(0) {} MatchParams &setDocIdLimit(docid_t value) { @@ -51,7 +46,7 @@ struct ParallelWeakAndSearch : public SearchIterator fef::TermFieldMatchData &rootMatchData; fef::MatchData::UP childrenMatchData; RankParams(fef::TermFieldMatchData &rootMatchData_, - fef::MatchData::UP &&childrenMatchData_) + fef::MatchData::UP &&childrenMatchData_) noexcept : rootMatchData(rootMatchData_), childrenMatchData(std::move(childrenMatchData_)) {} diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h index 88f0c9288f9..4ac1bf3d89b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h @@ -14,6 +14,7 @@ #include <vespa/vespalib/util/stringfmt.h> #include <cmath> +namespace search::queryeval { class WeakAndHeap; } namespace search::queryeval::wand { //----------------------------------------------------------------------------- @@ -25,6 +26,21 @@ using ref_t = uint16_t; //----------------------------------------------------------------------------- /** + * Params used to tweak the behavior of the WAND algorithm. + */ +struct MatchParams +{ + WeakAndHeap &scores; + score_t scoreThreshold; + const uint32_t scoresAdjustFrequency; + MatchParams(WeakAndHeap &scores_in, score_t scoreThreshold_in, uint32_t scoresAdjustFrequency_in) noexcept + : scores(scores_in), + scoreThreshold(scoreThreshold_in), + scoresAdjustFrequency(scoresAdjustFrequency_in) + {} +}; + +/** * Wrapper used to specify underlying terms during setup **/ struct Term { |