summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2021-10-11 12:38:31 +0000
committerArne H Juul <arnej@yahooinc.com>2021-10-11 12:38:31 +0000
commit5d90be219a53ceadef7a41c0f172475994b34f0f (patch)
tree54a4541a754e970603055635c4ce91f7d8aedc84 /searchlib
parent8d0461df6be53a74eba87ea5e7950cce97e75f75 (diff)
report issues instead of logging warnings in some features
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/features/array_parser.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/features/array_parser.h3
-rw-r--r--searchlib/src/vespa/searchlib/features/array_parser.hpp25
-rw-r--r--searchlib/src/vespa/searchlib/features/attributefeature.cpp32
-rw-r--r--searchlib/src/vespa/searchlib/features/bm25_feature.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/features/distancefeature.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp15
-rw-r--r--searchlib/src/vespa/searchlib/features/dotproductfeature.cpp18
-rw-r--r--searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/features/queryfeature.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp13
-rw-r--r--searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/features/weighted_set_parser.h3
-rw-r--r--searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp13
16 files changed, 98 insertions, 96 deletions
diff --git a/searchlib/src/vespa/searchlib/features/array_parser.cpp b/searchlib/src/vespa/searchlib/features/array_parser.cpp
index 7d3a1e9529f..c96339f0149 100644
--- a/searchlib/src/vespa/searchlib/features/array_parser.cpp
+++ b/searchlib/src/vespa/searchlib/features/array_parser.cpp
@@ -13,10 +13,4 @@ ArrayParser::parse(const vespalib::string &input, std::vector<int8_t> &output)
parse<std::vector<int8_t>, int16_t>(input, output);
}
-void
-ArrayParser::logWarning(const vespalib::string &msg)
-{
- LOG(warning, "%s", msg.c_str());
-}
-
}
diff --git a/searchlib/src/vespa/searchlib/features/array_parser.h b/searchlib/src/vespa/searchlib/features/array_parser.h
index 493ff271a2b..d662bb07309 100644
--- a/searchlib/src/vespa/searchlib/features/array_parser.h
+++ b/searchlib/src/vespa/searchlib/features/array_parser.h
@@ -21,9 +21,6 @@ namespace search::features {
*/
class ArrayParser
{
-private:
- static void logWarning(const vespalib::string &msg);
-
public:
template <typename T>
class ValueAndIndex {
diff --git a/searchlib/src/vespa/searchlib/features/array_parser.hpp b/searchlib/src/vespa/searchlib/features/array_parser.hpp
index 649b7ac665d..397b4c6588c 100644
--- a/searchlib/src/vespa/searchlib/features/array_parser.hpp
+++ b/searchlib/src/vespa/searchlib/features/array_parser.hpp
@@ -5,10 +5,12 @@
#include "array_parser.h"
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/vespalib/util/issue.h>
#include <vector>
#include <algorithm>
+using vespalib::Issue;
+
namespace search::features {
template <typename OutputType, typename T>
@@ -49,16 +51,14 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output)
if ((colon == ':') && is.eof()) {
output.emplace_back(value, key);
} else {
- logWarning(vespalib::make_string(
- "Could not parse item '%s' in query vector '%s', skipping. "
- "Expected ':' between dimension and component.",
- vespalib::string(item).c_str(), input.c_str()));
+ Issue::report("Could not parse item '%s' in query vector '%s', skipping. "
+ "Expected ':' between dimension and component.",
+ vespalib::string(item).c_str(), input.c_str());
return;
}
} catch (vespalib::IllegalArgumentException & e) {
- logWarning(vespalib::make_string(
- "Could not parse item '%s' in query vector '%s', skipping. "
- "Incorrect type of operands", vespalib::string(item).c_str(), input.c_str()));
+ Issue::report("Could not parse item '%s' in query vector '%s', skipping. "
+ "Incorrect type of operands", vespalib::string(item).c_str(), input.c_str());
return;
}
if (commaPos != vespalib::string::npos) {
@@ -75,17 +75,14 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output)
is >> value;
output.emplace_back(value, index++);
} catch (vespalib::IllegalArgumentException & e) {
- logWarning(vespalib::make_string(
- "Could not parse item[%ld] = '%s' in query vector '%s', skipping. "
- "Incorrect type of operands", output.size(), is.c_str(), vespalib::string(s).c_str()));
+ Issue::report("Could not parse item[%ld] = '%s' in query vector '%s', skipping. "
+ "Incorrect type of operands", output.size(), is.c_str(), vespalib::string(s).c_str());
return;
}
}
}
} else {
- logWarning(vespalib::make_string(
- "Could not parse query vector '%s'. Expected surrounding '(' and ')' or '{' and '}'.",
- input.c_str()));
+ Issue::report("Could not parse query vector '%s'. Expected surrounding '(' and ')' or '{' and '}'.", input.c_str());
}
}
diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
index d727ae33697..f6c51f66487 100644
--- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
@@ -16,11 +16,11 @@
#include <vespa/searchlib/attribute/singlenumericattribute.h>
#include <vespa/searchlib/attribute/multinumericattribute.h>
#include <vespa/searchlib/attribute/singleboolattribute.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/log/log.h>
LOG_SETUP(".features.attributefeature");
-
using search::attribute::IAttributeVector;
using search::attribute::BasicType;
using search::attribute::CollectionType;
@@ -35,6 +35,7 @@ using search::attribute::WeightedIntegerContent;
using search::attribute::WeightedFloatContent;
using search::fef::FeatureExecutor;
using search::features::util::ConstCharPtr;
+using vespalib::Issue;
using vespalib::eval::ValueType;
using search::fef::FeatureType;
using namespace search::index;
@@ -357,8 +358,8 @@ fef::FeatureExecutor &
createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, const vespalib::string &attrName, const vespalib::string &extraParam, vespalib::Stash &stash)
{
if (attribute == nullptr) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager, returning default values.",
- attrName.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager, returning default values.",
+ attrName.c_str());
std::vector<feature_t> values(numOutputs, 0.0f);
return stash.create<ValueExecutor>(values);
}
@@ -445,28 +446,29 @@ createTensorAttributeExecutor(const IAttributeVector *attribute, const vespalib:
vespalib::Stash &stash)
{
if (attribute == nullptr) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager."
- " Returning empty tensor.", attrName.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(tensorType, stash);
}
if (attribute->getCollectionType() != attribute::CollectionType::SINGLE ||
- attribute->getBasicType() != attribute::BasicType::TENSOR) {
- LOG(warning, "The attribute vector '%s' is NOT of type tensor."
- " Returning empty tensor.", attribute->getName().c_str());
+ attribute->getBasicType() != attribute::BasicType::TENSOR)
+ {
+ Issue::report("The attribute vector '%s' is NOT of type tensor."
+ "Returning empty tensor.", attribute->getName().c_str());
return ConstantTensorExecutor::createEmpty(tensorType, stash);
}
const ITensorAttribute *tensorAttribute = attribute->asTensorAttribute();
if (tensorAttribute == nullptr) {
- LOG(warning, "The attribute vector '%s' could not be converted to a tensor attribute."
- " Returning empty tensor.", attribute->getName().c_str());
+ Issue::report("The attribute vector '%s' could not be converted to a tensor attribute."
+ " Returning empty tensor.", attribute->getName().c_str());
return ConstantTensorExecutor::createEmpty(tensorType, stash);
}
if (tensorType != tensorAttribute->getTensorType()) {
- LOG(warning, "The tensor attribute '%s' has tensor type '%s',"
- " while the feature executor expects type '%s'. Returning empty tensor.",
- attribute->getName().c_str(),
- tensorAttribute->getTensorType().to_spec().c_str(),
- tensorType.to_spec().c_str());
+ Issue::report("The tensor attribute '%s' has tensor type '%s',"
+ " while the feature executor expects type '%s'. Returning empty tensor.",
+ attribute->getName().c_str(),
+ tensorAttribute->getTensorType().to_spec().c_str(),
+ tensorType.to_spec().c_str());
return ConstantTensorExecutor::createEmpty(tensorType, stash);
}
if (tensorAttribute->supports_extract_cells_ref()) {
diff --git a/searchlib/src/vespa/searchlib/features/bm25_feature.cpp b/searchlib/src/vespa/searchlib/features/bm25_feature.cpp
index 64e365b25ac..cd872edc57e 100644
--- a/searchlib/src/vespa/searchlib/features/bm25_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/bm25_feature.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchlib/fef/itermfielddata.h>
#include <vespa/searchlib/fef/objectstore.h>
#include <vespa/searchlib/fef/properties.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
#include <cmath>
#include <stdexcept>
@@ -23,6 +24,7 @@ using fef::ITermData;
using fef::ITermFieldData;
using fef::MatchDataDetails;
using fef::objectstore::as_value;
+using vespalib::Issue;
namespace {
@@ -105,8 +107,8 @@ Bm25Blueprint::lookup_param(const fef::Properties& props, const vespalib::string
try {
result = std::stod(value.get());
} catch (const std::invalid_argument& ex) {
- LOG(warning, "Not able to convert rank property '%s': '%s' to a double value",
- key.c_str(), value.get().c_str());
+ Issue::report("Not able to convert rank property '%s': '%s' to a double value",
+ key.c_str(), value.get().c_str());
return false;
}
}
diff --git a/searchlib/src/vespa/searchlib/features/distancefeature.cpp b/searchlib/src/vespa/searchlib/features/distancefeature.cpp
index c197d592a69..e9cb4222a15 100644
--- a/searchlib/src/vespa/searchlib/features/distancefeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/distancefeature.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/document/datatype/positiondatatype.h>
#include <vespa/vespalib/geo/zcurve.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
#include <cmath>
#include <limits>
@@ -16,6 +17,7 @@ LOG_SETUP(".features.distancefeature");
using namespace search::fef;
using namespace search::index::schema;
+using vespalib::Issue;
namespace search::features {
@@ -281,16 +283,16 @@ DistanceBlueprint::createExecutor(const IQueryEnvironment &env, vespalib::Stash
pos = env.getAttributeContext().getAttribute(_arg_string);
if (pos != nullptr) {
if (!pos->isIntegerType()) {
- LOG(warning, "The position attribute '%s' is not an integer attribute. Will use default distance.",
- pos->getName().c_str());
+ Issue::report("The position attribute '%s' is not an integer attribute. Will use default distance.",
+ pos->getName().c_str());
pos = nullptr;
} else if (pos->getCollectionType() == attribute::CollectionType::WSET) {
- LOG(warning, "The position attribute '%s' is a weighted set attribute. Will use default distance.",
- pos->getName().c_str());
+ Issue::report("The position attribute '%s' is a weighted set attribute. Will use default distance.",
+ pos->getName().c_str());
pos = nullptr;
}
} else {
- LOG(warning, "The position attribute '%s' was not found. Will use default distance.", _arg_string.c_str());
+ Issue::report("The position attribute '%s' was not found. Will use default distance.", _arg_string.c_str());
}
}
LOG(debug, "use '%s' locations with pos=%p", matching_locs.empty() ? "other" : "matching", pos);
diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
index 1c62a54ba18..4153a86d2e2 100644
--- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchlib/fef/properties.h>
#include <vespa/document/datatype/positiondatatype.h>
#include <vespa/vespalib/geo/zcurve.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
@@ -14,6 +15,8 @@
#include <vespa/log/log.h>
LOG_SETUP(".features.distancetopathfeature");
+using vespalib::Issue;
+
namespace search::features {
const feature_t DistanceToPathExecutor::DEFAULT_DISTANCE(6400000000.0);
@@ -153,19 +156,19 @@ DistanceToPathBlueprint::createExecutor(const search::fef::IQueryEnvironment &en
}
if (pos != nullptr) {
if (!pos->isIntegerType()) {
- LOG(warning, "The position attribute '%s' is not an integer attribute. Will use default distance.",
- pos->getName().c_str());
+ Issue::report("The position attribute '%s' is not an integer attribute. Will use default distance.",
+ pos->getName().c_str());
pos = nullptr;
} else if (pos->getCollectionType() == attribute::CollectionType::WSET) {
- LOG(warning, "The position attribute '%s' is a weighted set attribute. Will use default distance.",
- pos->getName().c_str());
+ Issue::report("The position attribute '%s' is a weighted set attribute. Will use default distance.",
+ pos->getName().c_str());
pos = nullptr;
}
} else {
- LOG(warning, "The position attribute '%s' was not found. Will use default distance.", _posAttr.c_str());
+ Issue::report("The position attribute '%s' was not found. Will use default distance.", _posAttr.c_str());
}
} else {
- LOG(warning, "No path given in query. Will use default distance.");
+ Issue::report("No path given in query. Will use default distance.");
}
// Create and return a compatible executor.
diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
index 63c1c26e054..f92c94e0c80 100644
--- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
@@ -13,6 +13,7 @@
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
#include <vespa/log/log.h>
@@ -22,6 +23,7 @@ using namespace search::attribute;
using namespace search::fef;
using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::TypedCells;
+using vespalib::Issue;
using vespalib::hwaccelrated::IAccelrated;
namespace search::features {
@@ -507,10 +509,10 @@ ArrayParam<T>::ArrayParam(vespalib::nbostream & stream) {
TypedCells cells = tensor->cells();
typify_invoke<1,TypifyCellType,CopyCellsToVector<T>>(cells.type, cells, values);
} else {
- LOG(warning, "Expected dense tensor, but got type '%s'", tensor->type().to_spec().c_str());
+ Issue::report("Expected dense tensor, but got type '%s'", tensor->type().to_spec().c_str());
}
} catch (const vespalib::eval::DecodeValueException &e) {
- LOG(warning, "Failed to decode tensor: %s", e.what());
+ Issue::report("Failed to decode tensor: %s", e.what());
}
}
@@ -773,8 +775,8 @@ createFromObject(const IAttributeVector * attribute, const fef::Anything & objec
}
// TODO: Add support for creating executor for weighted set string / integer attribute
// where the query vector is represented as an object instead of a string.
- LOG(warning, "The attribute vector '%s' is NOT of type array<int/long/float/double>"
- ", returning executor with default value.", attribute->getName().c_str());
+ Issue::report("The attribute vector '%s' is NOT of type array<int/long/float/double>"
+ ", returning executor with default value.", attribute->getName().c_str());
return stash.create<SingleZeroValueExecutor>();
}
@@ -880,8 +882,8 @@ createFromString(const IAttributeVector * attribute, const Property & prop, vesp
}
if (executor == nullptr) {
- LOG(warning, "The attribute vector '%s' is not of type weighted set string/integer nor"
- " array<int/long/float/double>, returning executor with default value.", attribute->getName().c_str());
+ Issue::report("The attribute vector '%s' is not of type weighted set string/integer nor"
+ " array<int/long/float/double>, returning executor with default value.", attribute->getName().c_str());
executor = &stash.create<SingleZeroValueExecutor>();
}
return *executor;
@@ -1107,8 +1109,8 @@ DotProductBlueprint::createExecutor(const IQueryEnvironment & env, vespalib::Sta
attribute = upgradeIfNecessary(attribute, env);
}
if (attribute == nullptr) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager, returning executor with default value.",
- getAttribute(env).c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager, returning executor with default value.",
+ getAttribute(env).c_str());
return stash.create<SingleZeroValueExecutor>();
}
vespalib::string scratchPad;
diff --git a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp
index 00dd54fbae6..f3640f38441 100644
--- a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/fef/properties.h>
#include <vespa/searchcommon/attribute/attributecontent.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
#include <cmath>
@@ -14,6 +15,7 @@ LOG_SETUP(".features.euclidean_distance_feature");
using namespace search::attribute;
using namespace search::fef;
+using vespalib::Issue;
namespace search::features {
@@ -97,8 +99,8 @@ EuclideanDistanceBlueprint::createExecutor(const IQueryEnvironment &env, vespali
{
const IAttributeVector * attribute = env.getAttributeContext().getAttribute(_attributeName);
if (attribute == nullptr) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager, returning executor with default value.",
- _attributeName.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager, returning executor with default value.",
+ _attributeName.c_str());
return stash.create<SingleZeroValueExecutor>();
}
@@ -111,8 +113,8 @@ EuclideanDistanceBlueprint::createExecutor(const IQueryEnvironment &env, vespali
return create<double>(*attribute, queryVector, stash);
}
}
- LOG(warning, "The attribute vector '%s' is NOT of type array<int/long/float/double>"
- ", returning executor with default value.", attribute->getName().c_str());
+ Issue::report("The attribute vector '%s' is NOT of type array<int/long/float/double>"
+ ", returning executor with default value.", attribute->getName().c_str());
return stash.create<SingleZeroValueExecutor>();
}
diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
index f28e4da778c..aacb9c03012 100644
--- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
@@ -10,6 +10,7 @@
#include <vespa/searchlib/fef/properties.h>
#include <vespa/searchlib/fef/featureexecutor.h>
#include <vespa/searchcommon/common/datatype.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/stash.h>
@@ -20,6 +21,7 @@ using namespace search::attribute;
using namespace search::fef;
using search::features::dotproduct::wset::IntegerVector;
+using vespalib::Issue;
namespace search::features {
@@ -168,8 +170,8 @@ selectExecutor(const IAttributeVector *attribute, V && vector, vespalib::Stash &
break;
}
}
- LOG(warning, "The attribute vector '%s' is not of type "
- "array<int/long>, returning executor with default value.", attribute->getName().c_str());
+ Issue::report("The attribute vector '%s' is not of type "
+ "array<int/long>, returning executor with default value.", attribute->getName().c_str());
return stash.create<SingleZeroValueExecutor>();
}
@@ -253,8 +255,8 @@ InternalMaxReduceProdJoinBlueprint::createExecutor(const IQueryEnvironment &env,
{
const IAttributeVector * attribute = lookupAttribute(_attrKey, _attribute, env);
if (attribute == nullptr) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager, "
- "returning executor with default value.", _attribute.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager, "
+ "returning executor with default value.", _attribute.c_str());
return stash.create<SingleZeroValueExecutor>();
}
const fef::Anything * queryVectorArg = env.getObjectStore().get(_queryVectorKey);
diff --git a/searchlib/src/vespa/searchlib/features/queryfeature.cpp b/searchlib/src/vespa/searchlib/features/queryfeature.cpp
index 78758e20ebb..56375eecbad 100644
--- a/searchlib/src/vespa/searchlib/features/queryfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/queryfeature.cpp
@@ -15,6 +15,7 @@
#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/fast_value.h>
#include <vespa/vespalib/locale/c.h>
+#include <vespa/vespalib/util/issue.h>
#include <cerrno>
#include <vespa/log/log.h>
@@ -24,6 +25,7 @@ using namespace search::fef;
using namespace search::fef::indexproperties;
using document::TensorDataType;
using vespalib::eval::ValueType;
+using vespalib::Issue;
using search::fef::FeatureType;
namespace search::features {
@@ -124,13 +126,13 @@ createTensorExecutor(const IQueryEnvironment &env,
try {
auto tensor = vespalib::eval::decode_value(stream, vespalib::eval::FastValueBuilderFactory::get());
if (!TensorDataType::isAssignableType(valueType, tensor->type())) {
- LOG(warning, "Query feature type is '%s' but other tensor type is '%s'",
- valueType.to_spec().c_str(), tensor->type().to_spec().c_str());
+ Issue::report("Query feature type is '%s' but other tensor type is '%s'",
+ valueType.to_spec().c_str(), tensor->type().to_spec().c_str());
return ConstantTensorExecutor::createEmpty(valueType, stash);
}
return ConstantTensorExecutor::create(std::move(tensor), stash);
} catch (const vespalib::eval::DecodeValueException &e) {
- LOG(warning, "Query feature has invalid binary format: %s", e.what());
+ Issue::report("Query feature has invalid binary format: %s", e.what());
return ConstantTensorExecutor::createEmpty(valueType, stash);
}
}
diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
index 6de6b0b5bcb..85b841e2cac 100644
--- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
@@ -10,6 +10,7 @@
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/value_type.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/log/log.h>
LOG_SETUP(".features.tensor_from_labels_feature");
@@ -21,6 +22,7 @@ using search::attribute::WeightedStringContent;
using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::ValueType;
using vespalib::eval::CellType;
+using vespalib::Issue;
using search::fef::FeatureType;
namespace search {
@@ -59,18 +61,18 @@ createAttributeExecutor(const search::fef::IQueryEnvironment &env,
{
const IAttributeVector *attribute = env.getAttributeContext().getAttribute(attrName);
if (attribute == NULL) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager."
- " Returning empty tensor.", attrName.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
if (attribute->isFloatingPointType()) {
- LOG(warning, "The attribute vector '%s' must have basic type string or integer."
- " Returning empty tensor.", attrName.c_str());
+ Issue::report("The attribute vector '%s' must have basic type string or integer."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
if (attribute->getCollectionType() == search::attribute::CollectionType::WSET) {
- LOG(warning, "The attribute vector '%s' is a weighted set - use tensorFromWeightedSet instead."
- " Returning empty tensor.", attrName.c_str());
+ Issue::report("The attribute vector '%s' is a weighted set - use tensorFromWeightedSet instead."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
// Note that for array attribute vectors the default weight is 1.0 for all values.
diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp
index dc054ed5206..96efc575b21 100644
--- a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp
@@ -11,6 +11,7 @@
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/value_type.h>
+#include <vespa/vespalib/util/issue.h>
#include <vespa/log/log.h>
LOG_SETUP(".features.tensor_from_weighted_set_feature");
@@ -22,6 +23,7 @@ using search::attribute::WeightedStringContent;
using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::ValueType;
using vespalib::eval::CellType;
+using vespalib::Issue;
using search::fef::FeatureType;
namespace search {
@@ -73,14 +75,15 @@ createAttributeExecutor(const search::fef::IQueryEnvironment &env,
{
const IAttributeVector *attribute = env.getAttributeContext().getAttribute(attrName);
if (attribute == NULL) {
- LOG(warning, "The attribute vector '%s' was not found in the attribute manager."
- " Returning empty tensor.", attrName.c_str());
+ Issue::report("The attribute vector '%s' was not found in the attribute manager."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
if (attribute->getCollectionType() != search::attribute::CollectionType::WSET ||
- attribute->isFloatingPointType()) {
- LOG(warning, "The attribute vector '%s' is NOT of type weighted set of string or integer."
- " Returning empty tensor.", attrName.c_str());
+ attribute->isFloatingPointType())
+ {
+ Issue::report("The attribute vector '%s' is NOT of type weighted set of string or integer."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
if (attribute->isIntegerType()) {
diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp b/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp
index 8a4e046e56f..b53528ead8a 100644
--- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp
+++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp
@@ -7,10 +7,4 @@ LOG_SETUP(".features.weighted_set_parser");
namespace search::features {
-void
-WeightedSetParser::logWarning(const vespalib::string &msg)
-{
- LOG(warning, "%s", msg.c_str());
-}
-
}
diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h
index ae2e5f7a125..6b649ac3b44 100644
--- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h
+++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h
@@ -15,9 +15,6 @@ namespace search::features {
*/
class WeightedSetParser
{
-private:
- static void logWarning(const vespalib::string &msg);
-
public:
template <typename OutputType>
static void parse(const vespalib::string &input, OutputType &output);
diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp
index dc7e59af4e6..d6fd057eb54 100644
--- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp
+++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp
@@ -3,7 +3,9 @@
#pragma once
#include "weighted_set_parser.h"
-#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/vespalib/util/issue.h>
+
+using vespalib::Issue;
namespace search::features {
@@ -27,9 +29,8 @@ WeightedSetParser::parse(const vespalib::string &input, OutputType &output)
vespalib::stringref value(item.substr(colonPos+1));
output.insert(key, value);
} else {
- logWarning(vespalib::make_string(
- "Could not parse item '%s' in input string '%s', skipping. "
- "Expected ':' between key and weight.", vespalib::string(item).c_str(), input.c_str()));
+ Issue::report("Could not parse item '%s' in input string '%s', skipping. "
+ "Expected ':' between key and weight.", vespalib::string(item).c_str(), input.c_str());
}
if (commaPos != vespalib::string::npos) {
s = s.substr(commaPos+1);
@@ -38,8 +39,8 @@ WeightedSetParser::parse(const vespalib::string &input, OutputType &output)
}
}
} else {
- logWarning(vespalib::make_string("Could not parse input string '%s'. "
- "Expected surrounding '(' and ')' or '{' and '}'.", input.c_str()));
+ Issue::report("Could not parse input string '%s'. "
+ "Expected surrounding '(' and ')' or '{' and '}'.", input.c_str());
}
}