diff options
author | Geir Storli <geirst@verizonmedia.com> | 2020-02-11 14:05:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 14:05:17 +0100 |
commit | ebfcce139ce2d561bd820973f03be923440c91b4 (patch) | |
tree | fb6d48d3a4409998f9f890a6180a61a99d11f32f /searchlib/src/tests | |
parent | 13c62d475d45f91541da9c6e6d36dff1a46f00bf (diff) | |
parent | e3e77d310e0ca6363a6b4571ca55f85356db60af (diff) |
Merge pull request #12135 from vespa-engine/geirst/hnsw-simplifications-with-distance-function-interface
Hnsw simplifications with distance function interface
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r-- | searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp index 634569cbc8c..081361b2fdc 100644 --- a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp @@ -1,6 +1,7 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/eval/tensor/dense/typed_cells.h> +#include <vespa/searchlib/tensor/distance_functions.h> #include <vespa/searchlib/tensor/doc_vector_access.h> #include <vespa/searchlib/tensor/hnsw_index.h> #include <vespa/searchlib/tensor/random_level_generator.h> @@ -41,14 +42,15 @@ struct LevelGenerator : public RandomLevelGenerator { }; using FloatVectors = MyDocVectorAccess<float>; -using FloatIndex = HnswIndex<float>; -using FloatIndexUP = std::unique_ptr<FloatIndex>; +using FloatSqEuclideanDistance = SquaredEuclideanDistance<float>; +using HnswIndexUP = std::unique_ptr<HnswIndex>; class HnswIndexTest : public ::testing::Test { public: FloatVectors vectors; + FloatSqEuclideanDistance distance_func; LevelGenerator level_generator; - FloatIndexUP index; + HnswIndexUP index; HnswIndexTest() : vectors(), @@ -60,8 +62,8 @@ public: .set(7, {3, 5}); } void init(bool heuristic_select_neighbors) { - index = std::make_unique<FloatIndex>(vectors, level_generator, - HnswIndexBase::Config(2, 1, 10, heuristic_select_neighbors)); + index = std::make_unique<HnswIndex>(vectors, distance_func, level_generator, + HnswIndex::Config(2, 1, 10, heuristic_select_neighbors)); } void add_document(uint32_t docid, uint32_t max_level = 0) { level_generator.level = max_level; |