MCPcopy Create free account
hub / github.com/antgroup/vsag / query_knn

Function query_knn

tests/test_multi_thread.cpp:28–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26#include "vsag/vsag.h"
27
28float
29query_knn(std::shared_ptr<vsag::Index> index,
30 const vsag::DatasetPtr& query,
31 int64_t id,
32 int64_t k,
33 const std::string& parameters,
34 const vsag::BitsetPtr invalid) {
35 if (auto result = index->KnnSearch(query, k, parameters, invalid); result.has_value()) {
36 if (result.value()->GetDim() != 0 && result.value()->GetIds()[0] == id) {
37 return 1.0;
38 }
39 }
40 return 0.0;
41}
42
43TEST_CASE("Test DiskAnn Multi-threading", "[ft][diskann]") {
44 fixtures::logger::LoggerReplacer _;

Callers 1

Calls 5

valueMethod · 0.80
KnnSearchMethod · 0.45
has_valueMethod · 0.45
GetDimMethod · 0.45
GetIdsMethod · 0.45

Tested by

no test coverage detected