diff options
8 files changed, 49 insertions, 54 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp index ee3c64f3cbb..547c4641fde 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp @@ -18,7 +18,7 @@ class TermDataExtractorVisitor vector<const ITermData *> &_term_data; public: - TermDataExtractorVisitor(vector<const ITermData *> &term_data) + explicit TermDataExtractorVisitor(vector<const ITermData *> &term_data) noexcept : _term_data(term_data) { } @@ -29,12 +29,12 @@ public: } } - virtual void visit(ProtonNodeTypes::AndNot &n) override { + void visit(ProtonNodeTypes::AndNot &n) override { assert(n.getChildren().size() > 0); n.getChildren()[0]->accept(*this); } - virtual void visit(ProtonNodeTypes::Equiv &n) override { + void visit(ProtonNodeTypes::Equiv &n) override { // XXX: unranked equiv not supported _term_data.push_back(&n); } 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] == '>'); diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h index efd5c93d267..734394c86ad 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h @@ -30,36 +30,24 @@ public: QueryEnvironment(const vespalib::string & location, const IndexEnvironment & indexEnv, const search::fef::Properties & properties, - const search::IAttributeManager * attrMgr = nullptr); - ~QueryEnvironment(); + const search::IAttributeManager * attrMgr); + ~QueryEnvironment() override; void addGeoLocation(const vespalib::string &field, const vespalib::string &location); + const search::fef::Properties & getProperties() const override { return _properties; } + uint32_t getNumTerms() const override { return _queryTerms.size(); } - // inherit documentation - virtual const search::fef::Properties & getProperties() const override { return _properties; } - - // inherit documentation - virtual uint32_t getNumTerms() const override { return _queryTerms.size(); } - - // inherit documentation - virtual const search::fef::ITermData *getTerm(uint32_t idx) const override { + const search::fef::ITermData *getTerm(uint32_t idx) const override { if (idx >= _queryTerms.size()) { return nullptr; } return _queryTerms[idx]; } - // inherit documentation GeoLocationSpecPtrs getAllLocations() const override; - - // inherit documentation - virtual const search::attribute::IAttributeContext & getAttributeContext() const override { return *_attrCtx; } - + const search::attribute::IAttributeContext & getAttributeContext() const override { return *_attrCtx; } double get_average_field_length(const vespalib::string &) const override { return 100.0; } - - // inherit documentation - virtual const search::fef::IIndexEnvironment & getIndexEnvironment() const override { return _indexEnv; } - + const search::fef::IIndexEnvironment & getIndexEnvironment() const override { return _indexEnv; } void addTerm(const search::fef::ITermData *term) { _queryTerms.push_back(term); } std::vector<vespalib::string> get_accessed_attributes() const { return _attrCtx->get_accessed_attributes(); } diff --git a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp index ac7a61e5888..825630f057b 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp @@ -106,6 +106,8 @@ RankProcessor::initQueryEnvironment() QueryWrapper::TermList & terms = _query.getTermList(); for (auto& term : terms) { + if (!term->isRanked()) continue; + if (term->isGeoLoc()) { const vespalib::string & fieldName = term->index(); const vespalib::string & locStr = term->getTermString(); |