diff options
Diffstat (limited to 'eval/src/tests/ann/find-with-nns.h')
-rw-r--r-- | eval/src/tests/ann/find-with-nns.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/eval/src/tests/ann/find-with-nns.h b/eval/src/tests/ann/find-with-nns.h new file mode 100644 index 00000000000..3481b403f86 --- /dev/null +++ b/eval/src/tests/ann/find-with-nns.h @@ -0,0 +1,12 @@ +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +TopK find_with_nns(uint32_t sk, NNS_API &nns, uint32_t qid) { + TopK result; + const PointVector &qv = generatedQueries[qid]; + vespalib::ConstArrayRef<float> query(qv.v, NUM_DIMS); + auto rv = nns.topK(result.K, query, sk); + for (size_t i = 0; i < result.K; ++i) { + result.hits[i] = Hit(rv[i].docid, rv[i].sq.distance); + } + return result; +} |