diff options
author | Håvard Pettersen <havardpe@oath.com> | 2019-06-19 10:18:08 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2019-06-19 10:18:08 +0000 |
commit | b8e30961b8c5f140823bd2828f87ab9fd906a1d7 (patch) | |
tree | fcb7752c120fc0d85995c3bd7cb056d640c7d51d /searchcore/src/apps | |
parent | 90671fd176dda18c44f26c77a396683da2b96b47 (diff) |
readjust to a world without ErrorValue
Diffstat (limited to 'searchcore/src/apps')
-rw-r--r-- | searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp index f60863ef0b0..721ee9978b0 100644 --- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp +++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp @@ -12,7 +12,6 @@ #include <vespa/eval/tensor/default_tensor_engine.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchcore/config/config-ranking-constants.h> -#include <vespa/searchcore/proton/matching/error_constant_value.h> #include <vespa/searchcore/proton/matching/indexenvironment.h> #include <vespa/searchlib/features/setup.h> #include <vespa/searchlib/fef/fef.h> @@ -34,11 +33,11 @@ using vespa::config::search::IndexschemaConfig; using vespa::config::search::RankProfilesConfig; using vespa::config::search::core::RankingConstantsConfig; using vespalib::eval::ConstantValue; -using vespalib::eval::ErrorValue; using vespalib::eval::TensorSpec; using vespalib::eval::ValueType; using vespalib::tensor::DefaultTensorEngine; using vespalib::eval::SimpleConstantValue; +using vespalib::eval::BadConstantValue; class App : public FastOS_Application { @@ -61,13 +60,17 @@ struct DummyConstantValueRepo : IConstantValueRepo { DummyConstantValueRepo(const RankingConstantsConfig &cfg_in) : cfg(cfg_in) {} virtual vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override { for (const auto &entry: cfg.constant) { - if (entry.name == name) { + if (entry.name == name) { const auto &engine = DefaultTensorEngine::ref(); - auto tensor = engine.from_spec(TensorSpec(entry.type)); - return std::make_unique<SimpleConstantValue>(std::move(tensor)); + try { + auto tensor = engine.from_spec(TensorSpec(entry.type)); + return std::make_unique<SimpleConstantValue>(std::move(tensor)); + } catch (std::exception &) { + return std::make_unique<BadConstantValue>(); + } } } - return std::make_unique<SimpleConstantValue>(std::make_unique<ErrorValue>()); + return vespalib::eval::ConstantValue::UP(nullptr); } }; |