diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-19 11:58:44 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-19 11:58:44 +0000 |
commit | 7788bf9ebb7294fef8c4e486cdb3f834078eddd4 (patch) | |
tree | dafa90fd0f1ae6eea869133ab77272482a7b2a99 /searchlib | |
parent | 852b79ee4275ecb59873b3dbba372aae6f2931e2 (diff) |
- Hide recall terms from ranking.
- Add noexcept.
Diffstat (limited to 'searchlib')
5 files changed, 37 insertions, 32 deletions
diff --git a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h index 0f80661bf38..d15e1ca0512 100644 --- a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h +++ b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h @@ -77,7 +77,7 @@ public: ~SimpleQueryStackDumpIterator(); vespalib::stringref getStack() const noexcept { return vespalib::stringref(_buf, _bufEnd - _buf); } - size_t getPosition() const { return _currPos; } + size_t getPosition() const noexcept { return _currPos; } /** * Moves to the next item in the buffer. @@ -91,7 +91,7 @@ public: * Get the type of the current item. * @return the type. */ - ParseItem::ItemType getType() const { return _currType; } + ParseItem::ItemType getType() const noexcept { return _currType; } /** * Get the type of the current item. * @return the type. @@ -103,40 +103,40 @@ public: * * @return rank weight. **/ - query::Weight GetWeight() const { return _currWeight; } + query::Weight GetWeight() const noexcept { return _currWeight; } /** * Get the unique id of the current item. * * @return unique id of current item **/ - uint32_t getUniqueId() const { return _currUniqueId; } + uint32_t getUniqueId() const noexcept { return _currUniqueId; } // Get the flags of the current item. - bool hasNoRankFlag() const { return (_currFlags & ParseItem::IFLAG_NORANK) != 0; } - bool hasSpecialTokenFlag() const { return (_currFlags & ParseItem::IFLAG_SPECIALTOKEN) != 0; } - bool hasNoPositionDataFlag() const { return (_currFlags & ParseItem::IFLAG_NOPOSITIONDATA) != 0; } + bool hasNoRankFlag() const noexcept { return (_currFlags & ParseItem::IFLAG_NORANK) != 0; } + bool hasSpecialTokenFlag() const noexcept { return (_currFlags & ParseItem::IFLAG_SPECIALTOKEN) != 0; } + bool hasNoPositionDataFlag() const noexcept { return (_currFlags & ParseItem::IFLAG_NOPOSITIONDATA) != 0; } - uint32_t getArity() const { return _currArity; } + uint32_t getArity() const noexcept { return _currArity; } - uint32_t getNearDistance() const { return _extraIntArg1; } - uint32_t getTargetHits() const { return _extraIntArg1; } - double getDistanceThreshold() const { return _extraDoubleArg4; } - double getScoreThreshold() const { return _extraDoubleArg4; } - double getThresholdBoostFactor() const { return _extraDoubleArg5; } - bool getAllowApproximate() const { return (_extraIntArg2 != 0); } - uint32_t getExploreAdditionalHits() const { return _extraIntArg3; } + uint32_t getNearDistance() const noexcept { return _extraIntArg1; } + uint32_t getTargetHits() const noexcept { return _extraIntArg1; } + double getDistanceThreshold() const noexcept { return _extraDoubleArg4; } + double getScoreThreshold() const noexcept { return _extraDoubleArg4; } + double getThresholdBoostFactor() const noexcept { return _extraDoubleArg5; } + bool getAllowApproximate() const noexcept { return (_extraIntArg2 != 0); } + uint32_t getExploreAdditionalHits() const noexcept { return _extraIntArg3; } // fuzzy match arguments - uint32_t getFuzzyMaxEditDistance() const { return _extraIntArg1; } - uint32_t getFuzzyPrefixLength() const { return _extraIntArg2; } + uint32_t getFuzzyMaxEditDistance() const noexcept { return _extraIntArg1; } + uint32_t getFuzzyPrefixLength() const noexcept { return _extraIntArg2; } std::unique_ptr<query::PredicateQueryTerm> getPredicateQueryTerm(); std::unique_ptr<query::TermVector> get_terms(); - vespalib::stringref getIndexName() const { return _curr_index_name; } - vespalib::stringref getTerm() const { return _curr_term; } - int64_t getIntergerTerm() const { return _curr_integer_term; } + vespalib::stringref getIndexName() const noexcept { return _curr_index_name; } + vespalib::stringref getTerm() const noexcept { return _curr_term; } + int64_t getIntergerTerm() const noexcept { return _curr_integer_term; } static vespalib::stringref DEFAULT_INDEX; }; diff --git a/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp b/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp index dd3b1f84ad9..16406bffd3d 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp @@ -137,6 +137,7 @@ QueryNode::Build(const QueryNode * parent, const QueryNodeResultFactory & factor } qt->setWeight(queryRep.GetWeight()); qt->setUniqueId(queryRep.getUniqueId()); + qt->setRanked( ! queryRep.hasNoRankFlag()); if (allowRewrite && possibleFloat(*qt, ssTerm) && factory.allow_float_terms_rewrite(ssIndex)) { auto phrase = std::make_unique<PhraseQueryNode>(factory.create(), ssIndex, arity); auto dotPos = ssTerm.find('.'); diff --git a/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp b/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp index 0d0f5a7c4ad..a9516d8aee4 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/queryterm.cpp @@ -69,10 +69,11 @@ QueryTerm::visitMembers(vespalib::ObjectVisitor & visitor) const QueryTerm::QueryTerm(std::unique_ptr<QueryNodeResultBase> org, stringref termS, const string & indexS, Type type, Normalizing normalizing) : QueryTermUCS4(QueryNormalization::optional_fold(termS, type, normalizing), type), + _hitList(), _index(indexS), - _encoding(0x01), _result(org.release()), - _hitList(), + _encoding(0x01), + _isRanked(true), _weight(100), _uniqueId(0), _fieldInfo() diff --git a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h index 2cb4f2d2ebb..1d0454f3b63 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h +++ b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h @@ -83,6 +83,8 @@ public: size_t termLen() const { return getTermLen(); } const string & index() const { return _index; } void setWeight(query::Weight v) { _weight = v; } + void setRanked(bool ranked) { _isRanked = ranked; } + bool isRanked() const { return _isRanked; } void setUniqueId(uint32_t u) { _uniqueId = u; } query::Weight weight() const { return _weight; } uint32_t uniqueId() const { return _uniqueId; } @@ -108,11 +110,12 @@ protected: template <typename HitListType> static void unpack_match_data_helper(uint32_t docid, const fef::ITermData& td, fef::MatchData& match_data, const HitListType& hit_list, const QueryTerm& fl_term); using QueryNodeResultBaseContainer = std::unique_ptr<QueryNodeResultBase>; - string _index; - EncodingBitMap _encoding; - QueryNodeResultBaseContainer _result; HitList _hitList; private: + string _index; + QueryNodeResultBaseContainer _result; + EncodingBitMap _encoding; + bool _isRanked; query::Weight _weight; uint32_t _uniqueId; std::vector<FieldInfo> _fieldInfo; diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h index bcecaa37870..2f57c3cb06d 100644 --- a/searchlib/src/vespa/searchlib/query/tree/term.h +++ b/searchlib/src/vespa/searchlib/query/tree/term.h @@ -23,16 +23,16 @@ public: virtual ~Term() = 0; void setView(const vespalib::string & view) { _view = view; } - void setRanked(bool ranked) { _ranked = ranked; } - void setPositionData(bool position_data) { _position_data = position_data; } + void setRanked(bool ranked) noexcept { _ranked = ranked; } + void setPositionData(bool position_data) noexcept { _position_data = position_data; } void setStateFrom(const Term& other); - const vespalib::string & getView() const { return _view; } - Weight getWeight() const { return _weight; } - int32_t getId() const { return _id; } - bool isRanked() const { return _ranked; } - bool usePositionData() const { return _position_data; } + const vespalib::string & getView() const noexcept { return _view; } + Weight getWeight() const noexcept { return _weight; } + int32_t getId() const noexcept { return _id; } + bool isRanked() const noexcept { return _ranked; } + bool usePositionData() const noexcept { return _position_data; } static bool isPossibleRangeTerm(vespalib::stringref term) noexcept { return (term[0] == '[' || term[0] == '<' || term[0] == '>'); |