diff options
author | Geir Storli <geirst@yahooinc.com> | 2024-02-19 19:47:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-19 19:47:05 +0100 |
commit | cfd5d6be8bebf1d862d8837afc51dd99338de788 (patch) | |
tree | da0c43377648758147a8871add92befed8adb9e4 | |
parent | 1c34797bdb870daa8d31ca95757fd3780d30c158 (diff) | |
parent | 68277fa5f1a5a5ab8631752687c2c2879ecf0741 (diff) |
Merge pull request #30329 from vespa-engine/havardpe/more-fetch-posting-flows
make flow calc mandatory (pure virtual)
4 files changed, 50 insertions, 2 deletions
diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index d739151a2c4..2a21d66c090 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -22,6 +22,9 @@ namespace { class MyOr : public IntermediateBlueprint { private: + FlowCalc make_flow_calc(bool strict, double flow) const override { + return flow_calc<OrFlow>(strict, flow); + } public: FlowStats calculate_flow_stats(uint32_t) const final { return {OrFlow::estimate_of(get_children()), diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h index 395512d84cc..c24790ddcf1 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h @@ -362,7 +362,7 @@ private: bool infer_want_global_filter() const; size_t count_termwise_nodes(const UnpackInfo &unpack) const; - virtual FlowCalc make_flow_calc(bool strict, double flow) const; + virtual FlowCalc make_flow_calc(bool strict, double flow) const = 0; protected: // returns an empty collection if children have empty or diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp index 6faa4ddf147..b8bf7d40655 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp @@ -206,6 +206,13 @@ AndNotBlueprint::createFilterSearch(bool strict, FilterConstraint constraint) co return create_andnot_filter(get_children(), strict, constraint); } + +FlowCalc +AndNotBlueprint::make_flow_calc(bool strict, double flow) const +{ + return flow_calc<AndNotFlow>(strict, flow); +} + //----------------------------------------------------------------------------- FlowStats @@ -417,6 +424,13 @@ OrBlueprint::calculate_cost_tier() const } //----------------------------------------------------------------------------- + +FlowCalc +WeakAndBlueprint::make_flow_calc(bool strict, double flow) const +{ + return flow_calc<OrFlow>(strict, flow); +} + WeakAndBlueprint::~WeakAndBlueprint() = default; FlowStats @@ -488,6 +502,12 @@ WeakAndBlueprint::createFilterSearch(bool strict, FilterConstraint constraint) c //----------------------------------------------------------------------------- +FlowCalc +NearBlueprint::make_flow_calc(bool strict, double flow) const +{ + return flow_calc<AndFlow>(strict, flow); +} + FlowStats NearBlueprint::calculate_flow_stats(uint32_t) const { double est = AndFlow::estimate_of(get_children()); @@ -553,6 +573,12 @@ NearBlueprint::createFilterSearch(bool strict, FilterConstraint constraint) cons //----------------------------------------------------------------------------- +FlowCalc +ONearBlueprint::make_flow_calc(bool strict, double flow) const +{ + return flow_calc<AndFlow>(strict, flow); +} + FlowStats ONearBlueprint::calculate_flow_stats(uint32_t) const { double est = AndFlow::estimate_of(get_children()); @@ -708,8 +734,20 @@ RankBlueprint::createFilterSearch(bool strict, FilterConstraint constraint) cons return create_first_child_filter(get_children(), strict, constraint); } +FlowCalc +RankBlueprint::make_flow_calc(bool strict, double flow) const +{ + return first_flow_calc(strict, flow); +} + //----------------------------------------------------------------------------- +FlowCalc +SourceBlenderBlueprint::make_flow_calc(bool strict, double flow) const +{ + return full_flow_calc(strict, flow); +} + SourceBlenderBlueprint::SourceBlenderBlueprint(const ISourceSelector &selector) noexcept : _selector(selector) { diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h index 25586022535..0095095dfe8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h @@ -29,6 +29,7 @@ public: SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; private: + FlowCalc make_flow_calc(bool strict, double flow) const override; uint8_t calculate_cost_tier() const override { return (childCnt() > 0) ? get_children()[0]->getState().cost_tier() : State::COST_TIER_NORMAL; } @@ -56,7 +57,7 @@ public: SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; private: - virtual FlowCalc make_flow_calc(bool strict, double flow) const override; + FlowCalc make_flow_calc(bool strict, double flow) const override; }; //----------------------------------------------------------------------------- @@ -93,6 +94,7 @@ private: uint32_t _n; std::vector<uint32_t> _weights; + FlowCalc make_flow_calc(bool strict, double flow) const override; public: FlowStats calculate_flow_stats(uint32_t docid_limit) const final; HitEstimate combine(const std::vector<HitEstimate> &data) const override; @@ -123,6 +125,7 @@ class NearBlueprint : public IntermediateBlueprint private: uint32_t _window; + FlowCalc make_flow_calc(bool strict, double flow) const override; public: FlowStats calculate_flow_stats(uint32_t docid_limit) const final; HitEstimate combine(const std::vector<HitEstimate> &data) const override; @@ -145,6 +148,7 @@ class ONearBlueprint : public IntermediateBlueprint private: uint32_t _window; + FlowCalc make_flow_calc(bool strict, double flow) const override; public: FlowStats calculate_flow_stats(uint32_t docid_limit) const final; HitEstimate combine(const std::vector<HitEstimate> &data) const override; @@ -181,6 +185,8 @@ public: uint8_t calculate_cost_tier() const override { return (childCnt() > 0) ? get_children()[0]->getState().cost_tier() : State::COST_TIER_NORMAL; } +private: + FlowCalc make_flow_calc(bool strict, double flow) const override; }; //----------------------------------------------------------------------------- @@ -190,6 +196,7 @@ class SourceBlenderBlueprint final : public IntermediateBlueprint private: const ISourceSelector &_selector; + FlowCalc make_flow_calc(bool strict, double flow) const override; public: explicit SourceBlenderBlueprint(const ISourceSelector &selector) noexcept; ~SourceBlenderBlueprint() override; |