diff --git a/src/search/hnsw_indexer.cc b/src/search/hnsw_indexer.cc index 15b77daa1fa..3618ad89bfc 100644 --- a/src/search/hnsw_indexer.cc +++ b/src/search/hnsw_indexer.cc @@ -619,7 +619,7 @@ StatusOr> HnswIndex::ExpandSearchScope(const kqir:: &neighbour_node_vector)); auto dist = GET_OR_RET(ComputeSimilarity(query_vector_item, neighbour_node_vector)); - result.emplace_back(dist, std::move(neighbour_key)); + result.emplace_back(dist, neighbour_key); } } std::sort(result.begin(), result.end(), diff --git a/tests/cppunit/hnsw_index_test.cc b/tests/cppunit/hnsw_index_test.cc index 1c83b075c96..3162c88f012 100644 --- a/tests/cppunit/hnsw_index_test.cc +++ b/tests/cppunit/hnsw_index_test.cc @@ -33,6 +33,7 @@ auto GetVectorKeys(const std::vector& keys_by_dist) -> std::vector { std::vector result; + result.reserve(keys_by_dist.size()); for (const auto& [dist, key] : keys_by_dist) { result.push_back(key); } @@ -49,7 +50,7 @@ void InsertEntryIntoHnswIndex(std::string_view key, const kqir::NumericArray& ve } void VerifyNodeMetadataAndNeighbours(redis::HnswNode* node, redis::HnswIndex* hnsw_index, - std::unordered_set expected_set) { + const std::unordered_set& expected_set) { auto s = node->DecodeMetadata(hnsw_index->search_key, hnsw_index->storage); ASSERT_TRUE(s.IsOK()); auto node_meta = s.GetValue();