diff options
34 files changed, 160 insertions, 12 deletions
diff --git a/dependency-versions/pom.xml b/dependency-versions/pom.xml index fc928b918be..18e3e47e241 100644 --- a/dependency-versions/pom.xml +++ b/dependency-versions/pom.xml @@ -65,7 +65,7 @@ <assertj.vespa.version>3.25.3</assertj.vespa.version> <!-- Athenz dependencies. Make sure these dependencies match those in Vespa's internal repositories --> - <aws-sdk.vespa.version>1.12.651</aws-sdk.vespa.version> + <aws-sdk.vespa.version>1.12.652</aws-sdk.vespa.version> <athenz.vespa.version>1.11.51</athenz.vespa.version> <!-- Athenz END --> @@ -125,7 +125,7 @@ <onnxruntime.vespa.version>1.16.3</onnxruntime.vespa.version> <opennlp.vespa.version>2.3.2</opennlp.vespa.version> <opentest4j.vespa.version>1.3.0</opentest4j.vespa.version> - <org.json.vespa.version>20231013</org.json.vespa.version> + <org.json.vespa.version>20240205</org.json.vespa.version> <org.lz4.vespa.version>1.8.0</org.lz4.vespa.version> <prometheus.client.vespa.version>0.16.0</prometheus.client.vespa.version> <plexus-interpolation.vespa.version>1.27</plexus-interpolation.vespa.version> diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp index 824ee891873..5e10d12e16f 100644 --- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp +++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp @@ -75,6 +75,9 @@ struct MockBlueprint : SimpleLeafBlueprint { { setEstimate(HitEstimate(756, false)); } + search::queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, 756, 0); + } SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { if (postings_fetched) { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index c434203898e..3f533fea28d 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -205,6 +205,9 @@ private: } return search::BitVectorIterator::create(&_activeLids, get_docid_limit(), *tfmd, strict); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, _activeLids.size(), 0); + } SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index 51164427690..d739151a2c4 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -145,6 +145,9 @@ struct MyTerm : SimpleLeafBlueprint { MyTerm(FieldSpecBase field, uint32_t hitEstimate) : SimpleLeafBlueprint(field) { setEstimate(HitEstimate(hitEstimate, false)); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, 0); + } SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const override { return {}; } diff --git a/searchlib/src/tests/queryeval/filter_search/filter_search_test.cpp b/searchlib/src/tests/queryeval/filter_search/filter_search_test.cpp index ca450c6d712..3e8bc06bfd8 100644 --- a/searchlib/src/tests/queryeval/filter_search/filter_search_test.cpp +++ b/searchlib/src/tests/queryeval/filter_search/filter_search_test.cpp @@ -71,6 +71,7 @@ struct LeafProxy : SimpleLeafBlueprint { : SimpleLeafBlueprint(), child(std::move(child_in)) { init(); } LeafProxy(FieldSpecBase field, std::unique_ptr<Blueprint> child_in) : SimpleLeafBlueprint(field), child(std::move(child_in)) { init(); } + FlowStats calculate_flow_stats(uint32_t) const override { abort(); } SearchIteratorUP createLeafSearch(const TermFieldMatchDataArray &, bool) const override { abort(); } SearchIteratorUP createFilterSearch(bool strict, Constraint constraint) const override { return child->createFilterSearch(strict, constraint); diff --git a/searchlib/src/tests/queryeval/queryeval_test.cpp b/searchlib/src/tests/queryeval/queryeval_test.cpp index c3a9a0d326e..e8f30ba84ff 100644 --- a/searchlib/src/tests/queryeval/queryeval_test.cpp +++ b/searchlib/src/tests/queryeval/queryeval_test.cpp @@ -358,6 +358,12 @@ public: _sc = _a.getSearch(std::make_unique<search::QueryTermSimple>("1", search::QueryTermSimple::Type::WORD), SearchContextParams().useBitVector(true)); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + auto est = _sc->calc_hit_estimate(); + return est.is_unknown() + ? default_flow_stats(0) + : default_flow_stats(docid_limit, est.est_hits(), 0); + } SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp index cbe497d6363..99812900d40 100644 --- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp +++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp @@ -35,6 +35,9 @@ struct MyTerm : public search::queryeval::SimpleLeafBlueprint { { setEstimate(HitEstimate(hits, (hits == 0))); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, 0); + } SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const override { return {}; } diff --git a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp index 3a10ed6df53..2a3ce66dba6 100644 --- a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp +++ b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp @@ -83,6 +83,9 @@ struct MyBlueprint : SimpleLeafBlueprint { set_allow_termwise_eval(allow_termwise_eval); } ~MyBlueprint() override; + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, 0); + } SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &, bool strict) const override { diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp index 24d62f66714..54663e48060 100644 --- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp +++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp @@ -344,6 +344,9 @@ struct VerifyMatchData { ++vmd.child_cnt; return std::make_unique<EmptySearch>(); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, 0, 0); + } [[nodiscard]] SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { return create_default_filter(strict, constraint); } diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 09da4697583..f358ee56dd4 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -265,6 +265,10 @@ public: bool should_use() const { return _should_use; } + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, _rangeSearches.size()); + } + SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { @@ -324,6 +328,10 @@ public: const common::Location &location() const { return _location; } + queryeval::FlowStats calculate_flow_stats(uint32_t) const override { + return default_flow_stats(0); + } + SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { @@ -449,6 +457,10 @@ public: setEstimate(estimate); } + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, _terms.size()); + } + SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { assert(tfmda.size() == 1); if (_terms.empty()) { diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp index a5003ba542b..ede2ecd0ad5 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.cpp @@ -116,6 +116,12 @@ AttributeWeightedSetBlueprint::addToken(std::unique_ptr<ISearchContext> context, _contexts.push_back(context.release()); } +queryeval::FlowStats +AttributeWeightedSetBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _estHits, _weights.size()); +} + queryeval::SearchIterator::UP AttributeWeightedSetBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.h b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.h index d24bfa64111..16319654024 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.h +++ b/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.h @@ -28,6 +28,7 @@ public: AttributeWeightedSetBlueprint(const queryeval::FieldSpec &field, const IAttributeVector & attr); ~AttributeWeightedSetBlueprint(); void addToken(std::unique_ptr<ISearchContext> context, int32_t weight); + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override; queryeval::SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; queryeval::SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; void fetchPostings(const queryeval::ExecuteInfo &execInfo) override; diff --git a/searchlib/src/vespa/searchlib/attribute/direct_multi_term_blueprint.h b/searchlib/src/vespa/searchlib/attribute/direct_multi_term_blueprint.h index 485427391ad..e0b206dbdd9 100644 --- a/searchlib/src/vespa/searchlib/attribute/direct_multi_term_blueprint.h +++ b/searchlib/src/vespa/searchlib/attribute/direct_multi_term_blueprint.h @@ -71,6 +71,10 @@ public: setEstimate(estimate); } + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, _terms.size()); + } + std::unique_ptr<queryeval::SearchIterator> createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool) const override; std::unique_ptr<queryeval::SearchIterator> createFilterSearch(bool strict, FilterConstraint constraint) const override; diff --git a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp index 08a690ce9fe..97c8dd391ba 100644 --- a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp @@ -65,6 +65,12 @@ DiskTermBlueprint::fetchPostings(const queryeval::ExecuteInfo &execInfo) _fetchPostingsDone = true; } +queryeval::FlowStats +DiskTermBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _lookupRes->counts._numDocs, 0); +} + SearchIterator::UP DiskTermBlueprint::createLeafSearch(const TermFieldMatchDataArray & tfmda, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h index 1f04a4a804b..a8754663aab 100644 --- a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h +++ b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h @@ -37,6 +37,8 @@ public: DiskIndex::LookupResult::UP lookupRes, bool useBitVector); + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + // Inherit doc from Blueprint. // For now, this DiskTermBlueprint instance must have longer lifetime than the created iterator. std::unique_ptr<queryeval::SearchIterator> createLeafSearch(const fef::TermFieldMatchDataArray & tfmda, bool strict) const override; diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp index 18b5d749aeb..24582d7e692 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp @@ -256,6 +256,10 @@ public: setEstimate(estimate); } + queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, _posting_itr.size(), 0); + } + SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray& tfmda, bool) const override { auto result = make_search_iterator<interleaved_features>(_posting_itr, _feature_store, _field_id, tfmda); if (_use_bit_vector) { diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp index b05e5cbef3d..2f69c45d418 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp @@ -161,6 +161,20 @@ Blueprint::root() const return *bp; } +FlowStats +Blueprint::default_flow_stats(uint32_t docid_limit, uint32_t abs_est, size_t child_cnt) +{ + double rel_est = abs_to_rel_est(abs_est, docid_limit); + double seek_cost = (child_cnt == 0) ? rel_est : (rel_est * 2.0); + return {rel_est, 1.0 + child_cnt, seek_cost}; +} + +FlowStats +Blueprint::default_flow_stats(size_t child_cnt) +{ + return {0.5, 1.0 + child_cnt, 1.0 + child_cnt}; +} + std::unique_ptr<MatchingElementsSearch> Blueprint::create_matching_elements_search(const MatchingElementsFields &fields) const { @@ -714,13 +728,6 @@ IntermediateBlueprint::calculateUnpackInfo(const fef::MatchData & md) const //----------------------------------------------------------------------------- -FlowStats -LeafBlueprint::calculate_flow_stats(uint32_t docid_limit) const -{ - double rel_est = abs_to_rel_est(_state.estimate().estHits, docid_limit); - return {rel_est, 1.0, rel_est}; -} - void LeafBlueprint::fetchPostings(const ExecuteInfo &) { @@ -791,8 +798,6 @@ LeafBlueprint::set_tree_size(uint32_t value) } -//----------------------------------------------------------------------------- - void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const search::queryeval::Blueprint *obj) { diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h index 20606c713a5..510351a4843 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h @@ -278,6 +278,8 @@ public: void update_flow_stats(uint32_t docid_limit) { _flow_stats = calculate_flow_stats(docid_limit); } + static FlowStats default_flow_stats(uint32_t docid_limit, uint32_t abs_est, size_t child_cnt); + static FlowStats default_flow_stats(size_t child_cnt); virtual void fetchPostings(const ExecuteInfo &execInfo) = 0; virtual void freeze() = 0; @@ -453,7 +455,6 @@ protected: public: ~LeafBlueprint() override = default; const State &getState() const final { return _state; } - FlowStats calculate_flow_stats(uint32_t docid_limit) const override; void fetchPostings(const ExecuteInfo &execInfo) override; void freeze() final; SearchIteratorUP createSearch(fef::MatchData &md, bool strict) const override; diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp index 51f73158090..3b8975f9883 100644 --- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp @@ -38,6 +38,12 @@ DotProductBlueprint::addTerm(Blueprint::UP term, int32_t weight, HitEstimate & e _terms.push_back(std::move(term)); } +FlowStats +DotProductBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, getState().estimate().estHits, _terms.size()); +} + SearchIterator::UP DotProductBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h index e49e163d24d..ca59f84fce8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h @@ -33,6 +33,8 @@ public: setEstimate(estimate); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + SearchIteratorUP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override; diff --git a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp index ef03a140a35..84745fdd0bd 100644 --- a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp @@ -52,6 +52,12 @@ EquivBlueprint::EquivBlueprint(FieldSpecBaseList fields, EquivBlueprint::~EquivBlueprint() = default; +FlowStats +EquivBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _estimate.estHits, _terms.size()); +} + SearchIterator::UP EquivBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &outputs, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.h index df1ea13105a..27e990b3320 100644 --- a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.h @@ -22,6 +22,8 @@ public: // used by create visitor EquivBlueprint& addTerm(Blueprint::UP term, double exactness); + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override; diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp index 6c619ee085b..b12c2eea404 100644 --- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp @@ -10,6 +10,12 @@ namespace search::queryeval { //----------------------------------------------------------------------------- +FlowStats +EmptyBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, 0, 0); +} + SearchIterator::UP EmptyBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const { @@ -27,6 +33,12 @@ EmptyBlueprint::EmptyBlueprint(FieldSpecBaseList fields) { } +FlowStats +AlwaysTrueBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, docid_limit, 0); +} + SearchIterator::UP AlwaysTrueBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const { @@ -46,6 +58,12 @@ AlwaysTrueBlueprint::AlwaysTrueBlueprint() : SimpleLeafBlueprint() //----------------------------------------------------------------------------- +FlowStats +SimpleBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _result.getHitCount(), 0); +} + SearchIterator::UP SimpleBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h index a1c23649dd6..d967933fbee 100644 --- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h +++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h @@ -19,6 +19,7 @@ public: EmptyBlueprint(FieldSpecBaseList fields); EmptyBlueprint(FieldSpecBase field) : SimpleLeafBlueprint(field) {} EmptyBlueprint() = default; + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; EmptyBlueprint *as_empty() noexcept final override { return this; } }; @@ -29,6 +30,7 @@ protected: SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override; public: AlwaysTrueBlueprint(); + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; }; @@ -48,6 +50,7 @@ public: ~SimpleBlueprint() override; SimpleBlueprint &tag(const vespalib::string &tag); const vespalib::string &tag() const { return _tag; } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override; }; @@ -88,6 +91,10 @@ public: return _ctx.get(); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, _result.inspect().size(), 0); + } + SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { return create_default_filter(strict, constraint); } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h index 1163f6a8805..73608b8172b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.h @@ -69,6 +69,10 @@ public: Algorithm get_algorithm() const { return _algorithm; } double get_distance_threshold() const { return _distance_threshold; } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override { + return default_flow_stats(docid_limit, getState().estimate().estHits, 0); + } + std::unique_ptr<SearchIterator> createLeafSearch(const search::fef::TermFieldMatchDataArray& tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h index ed4b088f576..d9c432b38bd 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h @@ -49,6 +49,11 @@ public: ~PredicateBlueprint(); void fetchPostings(const ExecuteInfo &execInfo) override; + FlowStats calculate_flow_stats(uint32_t) const override { + return default_flow_stats(_interval_btree_iterators.size() + _interval_vector_iterators.size() + + _bounds_btree_iterators.size() + _bounds_vector_iterators.size() + 2); + } + SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp index 96181377282..3d4f917aeac 100644 --- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp @@ -44,6 +44,12 @@ SameElementBlueprint::addTerm(Blueprint::UP term) _terms.push_back(std::move(term)); } +FlowStats +SameElementBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _estimate.estHits, _terms.size()); +} + void SameElementBlueprint::optimize_self(OptimizePass pass) { diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h index 6a988e67149..279a5f7d654 100644 --- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h @@ -34,6 +34,8 @@ public: // used by create visitor void addTerm(Blueprint::UP term); + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + void optimize_self(OptimizePass pass) override; void fetchPostings(const ExecuteInfo &execInfo) override; diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp index 3cb69f00240..ace7d12c32b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp @@ -45,6 +45,12 @@ SimplePhraseBlueprint::addTerm(Blueprint::UP term) _terms.push_back(std::move(term)); } +FlowStats +SimplePhraseBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, _estimate.estHits, _terms.size()); +} + SearchIterator::UP SimplePhraseBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h index 64c1cc7d6f4..da7ec9c9b36 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h @@ -30,6 +30,8 @@ public: // used by create visitor void addTerm(Blueprint::UP term); + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override; void visitMembers(vespalib::ObjectVisitor &visitor) const override; diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp index e85e81e21e5..4e400b3c055 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp @@ -65,6 +65,12 @@ ParallelWeakAndBlueprint::addTerm(Blueprint::UP term, int32_t weight, HitEstimat _terms.push_back(std::move(term)); } +FlowStats +ParallelWeakAndBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, getState().estimate().estHits, _terms.size()); +} + SearchIterator::UP ParallelWeakAndBlueprint::createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h index f023d203100..ade64577c80 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h @@ -62,6 +62,8 @@ public: set_tree_size(_terms.size() + 1); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; std::unique_ptr<SearchIterator> createFilterSearch(bool strict, FilterConstraint constraint) const override; void visitMembers(vespalib::ObjectVisitor &visitor) const override; diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp index e2e9516badf..b3bbec8428f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp @@ -92,6 +92,12 @@ WeightedSetTermBlueprint::addTerm(Blueprint::UP term, int32_t weight, HitEstimat _terms.push_back(std::move(term)); } +FlowStats +WeightedSetTermBlueprint::calculate_flow_stats(uint32_t docid_limit) const +{ + return default_flow_stats(docid_limit, getState().estimate().estHits, _terms.size()); +} + SearchIterator::UP WeightedSetTermBlueprint::createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h index 83203ea6533..240b2a47eb3 100644 --- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h @@ -35,6 +35,8 @@ public: setEstimate(estimate); } + FlowStats calculate_flow_stats(uint32_t docid_limit) const override; + SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override; std::unique_ptr<MatchingElementsSearch> create_matching_elements_search(const MatchingElementsFields &fields) const override; |