diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-07-06 21:24:28 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-07-06 21:24:28 +0000 |
commit | 4e56e61abb869a85095a45175ee2f6427ac70b34 (patch) | |
tree | 0f7743b166530fd5bd0e2a4f9dbe439b471c6a45 | |
parent | dfad0a3a161cd91a94b177c3345f1c62f16269d5 (diff) |
Use ConstArrayRef instead of const ref to std::vector.
-rw-r--r-- | searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp index fb8d2f484b9..d2e4af98277 100644 --- a/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_search.cpp @@ -4,30 +4,29 @@ #include "iterator_pack.h" #include <vespa/vespalib/objects/visit.h> - using search::fef::TermFieldMatchData; using search::fef::MatchData; using vespalib::ObjectVisitor; namespace search::queryeval { - template <typename HEAP, typename IteratorPack> class DotProductSearchImpl : public DotProductSearch { private: using ref_t = uint32_t; + using Weights = vespalib::ConstArrayRef<int32_t>; struct CmpDocId { const uint32_t *termPos; - CmpDocId(const uint32_t *tp) : termPos(tp) {} - bool operator()(const ref_t &a, const ref_t &b) const { + CmpDocId(const uint32_t *tp) noexcept : termPos(tp) {} + bool operator()(const ref_t &a, const ref_t &b) const noexcept { return (termPos[a] < termPos[b]); } }; TermFieldMatchData &_tmd; - const std::vector<int32_t> &_weights; + Weights _weights; std::vector<uint32_t> _termPos; CmpDocId _cmpDocId; std::vector<ref_t> _data_space; @@ -112,7 +111,7 @@ public: HEAP::push(_data_begin, ++_data_stash, _cmpDocId); } } - Trinary is_strict() const override { return Trinary::True; } + Trinary is_strict() const final { return Trinary::True; } void visitMembers(vespalib::ObjectVisitor &) const override {} }; |