diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-12-04 12:52:36 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-12-06 20:59:46 +0100 |
commit | ea1305d578ca3ff11503eb30109a408f6c150fcb (patch) | |
tree | 093b10f90101decbbd23d693713ca3ebd1844d7e | |
parent | c9785734e2bf04e063cb693a54f6d769a1a83704 (diff) |
use DenseCellsValue in NearestNeighborBlueprint
-rw-r--r-- | eval/src/vespa/eval/eval/dense_cells_value.h | 5 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/eval/src/vespa/eval/eval/dense_cells_value.h b/eval/src/vespa/eval/eval/dense_cells_value.h index 021203ec78a..47ca0fb2e09 100644 --- a/eval/src/vespa/eval/eval/dense_cells_value.h +++ b/eval/src/vespa/eval/eval/dense_cells_value.h @@ -1,6 +1,7 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/eval/eval/value.h> +#include <cassert> namespace vespalib::eval { @@ -15,7 +16,9 @@ private: public: DenseCellsValue(const ValueType &type_ref, std::vector<T> cells) : _type(type_ref), _cells(std::move(cells)) - {} + { + assert(check_cell_type<T>(_type.cell_type())); + } const ValueType &type() const override { return _type; } TypedCells cells() const override { return TypedCells(_cells); } const Index &index() const override { return TrivialIndex::get(); } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp index d75cda2e513..d3ecffd1605 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp @@ -4,16 +4,16 @@ #include "nearest_neighbor_blueprint.h" #include "nearest_neighbor_iterator.h" #include "nns_index_iterator.h" +#include <vespa/eval/eval/dense_cells_value.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> -#include <vespa/eval/tensor/dense/dense_tensor.h> #include <vespa/searchlib/tensor/dense_tensor_attribute.h> #include <vespa/searchlib/tensor/distance_function_factory.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.queryeval.nearest_neighbor_blueprint"); +using vespalib::eval::DenseCellsValue; using vespalib::eval::Value; -using vespalib::tensor::DenseTensor; namespace search::queryeval { @@ -21,7 +21,7 @@ namespace { template<typename LCT, typename RCT> void -convert_cells(std::unique_ptr<Value> &original, vespalib::eval::ValueType want_type) +convert_cells(std::unique_ptr<Value> &original, const vespalib::eval::ValueType &want_type) { auto old_cells = original->cells().typify<LCT>(); std::vector<RCT> new_cells; @@ -30,16 +30,16 @@ convert_cells(std::unique_ptr<Value> &original, vespalib::eval::ValueType want_t RCT conv = value; new_cells.push_back(conv); } - original = std::make_unique<DenseTensor<RCT>>(want_type, std::move(new_cells)); + original = std::make_unique<DenseCellsValue<RCT>>(want_type, std::move(new_cells)); } template<> void -convert_cells<float,float>(std::unique_ptr<Value> &, vespalib::eval::ValueType) {} +convert_cells<float,float>(std::unique_ptr<Value> &, const vespalib::eval::ValueType &) {} template<> void -convert_cells<double,double>(std::unique_ptr<Value> &, vespalib::eval::ValueType) {} +convert_cells<double,double>(std::unique_ptr<Value> &, const vespalib::eval::ValueType &) {} struct ConvertCellsSelector { |