diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-02-19 12:14:14 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-02-19 12:15:00 +0000 |
commit | 6d06888aeadc0f10f9c5ac1d0e780fdbb00701aa (patch) | |
tree | ee08f6a8ac404f91af59aae264c7d8c3c483e804 /searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp | |
parent | d3853d707b9fd95a7cdb9d0edf1ad8de245dc049 (diff) |
expose explore_k in top level API
Diffstat (limited to 'searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp')
-rw-r--r-- | searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp | 6 |
1 files changed, 3 insertions, 3 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 1b821a05c84..c6246bb8434 100644 --- a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp @@ -89,10 +89,10 @@ public: void expect_top_3(uint32_t docid, std::vector<uint32_t> exp_hits) { uint32_t k = 3; auto qv = vectors.get_vector(docid); - auto rv = index->top_k_candidates(qv, k); + auto rv = index->top_k_candidates(qv, k).peek(); + std::sort(rv.begin(), rv.end(), LesserDistance()); size_t idx = 0; for (const auto & hit : rv) { - // fprintf(stderr, "found docid %u dist %.1f\n", hit.docid, hit.distance); if (idx < exp_hits.size()) { EXPECT_EQ(hit.docid, exp_hits[idx++]); } @@ -100,7 +100,7 @@ public: if (exp_hits.size() == k) { std::vector<uint32_t> expected_by_docid = exp_hits; std::sort(expected_by_docid.begin(), expected_by_docid.end()); - std::vector<uint32_t> got_by_docid = index->find_top_k(qv, k); + std::vector<uint32_t> got_by_docid = index->find_top_k(k, qv, k); EXPECT_EQ(expected_by_docid, got_by_docid); } } |