From b292b9adb7d8a4b7d8555a5a96d2e0859466e709 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Mon, 25 Apr 2022 13:32:58 +0200 Subject: Remove unused useKey argument in WeightedSetAttributeExecutor. --- .../vespa/searchlib/features/attributefeature.cpp | 41 +++++++++------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'searchlib') diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp index 3e39ea830ca..485f9af90d0 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp @@ -213,7 +213,6 @@ private: attribute::BasicType::Type _attrType; BT _buffer; // used when fetching values and weights from the attribute T _key; // the key to find a weight for - bool _useKey; public: /** @@ -221,9 +220,8 @@ public: * * @param attribue The attribute vector to use. * @param key The key to find a corresponding weight for. - * @param useKey Whether we should consider the key. */ - WeightedSetAttributeExecutor(const attribute::IAttributeVector * attribute, T key, bool useKey); + WeightedSetAttributeExecutor(const attribute::IAttributeVector * attribute, T key); void execute(uint32_t docId) override; }; @@ -282,13 +280,12 @@ AttributeExecutor::execute(uint32_t docId) template -WeightedSetAttributeExecutor::WeightedSetAttributeExecutor(const IAttributeVector * attribute, T key, bool useKey) : - fef::FeatureExecutor(), - _attribute(attribute), - _attrType(attribute->getBasicType()), - _buffer(), - _key(key), - _useKey(useKey) +WeightedSetAttributeExecutor::WeightedSetAttributeExecutor(const IAttributeVector * attribute, T key) + : fef::FeatureExecutor(), + _attribute(attribute), + _attrType(attribute->getBasicType()), + _buffer(), + _key(key) { } @@ -300,18 +297,14 @@ WeightedSetAttributeExecutor::execute(uint32_t docId) feature_t weight = 0.0f; feature_t contains = 0.0f; feature_t count = 0.0f; - if (_useKey) { - _buffer.fill(*_attribute, docId); - for (uint32_t i = 0; i < _buffer.size(); ++i) { - if (equals(_buffer[i].getValue(), _key)) { - value = considerUndefined(_key, _attrType); - weight = static_cast(_buffer[i].getWeight()); - contains = 1.0f; - break; - } + _buffer.fill(*_attribute, docId); + for (uint32_t i = 0; i < _buffer.size(); ++i) { + if (equals(_buffer[i].getValue(), _key)) { + value = considerUndefined(_key, _attrType); + weight = static_cast(_buffer[i].getWeight()); + contains = 1.0f; + break; } - } else { - count = _attribute->getValueCount(docId); } outputs().set_number(0, value); // value outputs().set_number(1, weight); // weight @@ -370,11 +363,11 @@ createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, bool useKey = !extraParam.empty(); if (useKey) { if (attribute->isStringType()) { - return stash.create>(attribute, extraParam, useKey); + return stash.create>(attribute, extraParam); } else if (attribute->isIntegerType()) { - return stash.create>(attribute, util::strToNum(extraParam), useKey); + return stash.create>(attribute, util::strToNum(extraParam)); } else { // FLOAT - return stash.create>(attribute, util::strToNum(extraParam), useKey); + return stash.create>(attribute, util::strToNum(extraParam)); } } else { return stash.create(*attribute); -- cgit v1.2.3