From 690891b6b48124fe05bca22872f923a34ecb5591 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Wed, 31 May 2023 14:22:50 +0200 Subject: Add Doom to hnsw index. --- ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ann_benchmark/src') diff --git a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp index a52e0850b7d..730ee141f83 100644 --- a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp +++ b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ class HnswIndex const NearestNeighborIndex* _nearest_neighbor_index; size_t _dim_size; bool _normalize_vectors; + vespalib::FakeDoom _no_doom; bool check_lid(uint32_t lid); bool check_value(const char *op, const std::vector& value); @@ -87,7 +89,8 @@ HnswIndex::HnswIndex(uint32_t dim_size, const HnswIndexParams &hnsw_index_params _tensor_attribute(nullptr), _nearest_neighbor_index(nullptr), _dim_size(0u), - _normalize_vectors(normalize_vectors) + _normalize_vectors(normalize_vectors), + _no_doom() { Config cfg(BasicType::TENSOR, CollectionType::SINGLE); _tensor_type = ValueType::from_spec(make_tensor_spec(dim_size)); @@ -208,7 +211,7 @@ HnswIndex::find_top_k(uint32_t k, const std::vector& value, uint32_t expl std::vector normalized_value; auto typed_cells = get_typed_cells(value, normalized_value); auto df = _nearest_neighbor_index->distance_function_factory().for_query_vector(typed_cells); - auto raw_result = _nearest_neighbor_index->find_top_k(k, *df, explore_k, std::numeric_limits::max()); + auto raw_result = _nearest_neighbor_index->find_top_k(k, *df, explore_k, _no_doom.get_doom(), std::numeric_limits::max()); result.reserve(raw_result.size()); switch (_hnsw_index_params.distance_metric()) { case DistanceMetric::Euclidean: -- cgit v1.2.3