Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
Signed-off-by: jinjiabao.jjb <[email protected]>
  • Loading branch information
jinjiabao.jjb committed Dec 25, 2024
1 parent 18a6a29 commit d323e8b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/test_hnsw_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ TEST_CASE_PERSISTENT_FIXTURE(fixtures::HNSWTestIndex, "HNSW Search with Nan", "[
auto param = GenerateHNSWBuildParametersString(metric_type, dim);
auto index = TestFactory(name, param, true);
TestContinueAdd(index, dataset, true);
TestKnnSearchWithNan(index, dataset, search_param, 0.98, true);
TestSearchWithNan(index, dataset, search_param, 0.98, true);
vsag::Options::Instance().set_block_size_limit(origin_size);
}

Expand Down
7 changes: 2 additions & 5 deletions tests/test_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ TestIndex::TestSerializeFile(const IndexPtr& index_from,
}
}
void
TestIndex::TestKnnSearchWithNan(const TestIndex::IndexPtr& index,
TestIndex::TestSearchWithNan(const TestIndex::IndexPtr& index,
const TestDatasetPtr& dataset,
const std::string& search_param,
float recall,
Expand Down Expand Up @@ -307,9 +307,6 @@ TestIndex::TestKnnSearchWithNan(const TestIndex::IndexPtr& index,
REQUIRE((res.value()->GetDim() >= topk && res.value()->GetDim() <= topk + 1));
auto result = res.value()->GetIds();
auto dists = res.value()->GetDistances();
for (int j = 0; j < topk; ++j) {
REQUIRE_FALSE(std::isnan(dists[j]));
}
auto gt = gts->GetIds() + gt_topK * i;
auto val = Intersection(gt, gt_topK, result, topk);
cur_recall += static_cast<float>(val) / static_cast<float>(gt_topK);
Expand Down Expand Up @@ -483,4 +480,4 @@ TestIndex::TestDuplicateAdd(const TestIndex::IndexPtr& index, const TestDatasetP
check_func(add_index_2.value());
}

} // namespace fixtures
} // namespace fixtures
2 changes: 1 addition & 1 deletion tests/test_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TestIndex {
bool expected_success = true);

static void
TestKnnSearchWithNan(const IndexPtr& index,
TestSearchWithNan(const IndexPtr& index,
const TestDatasetPtr& dataset,
const std::string& search_param,
float recall = 0.99,
Expand Down

0 comments on commit d323e8b

Please sign in to comment.