Skip to content

Commit

Permalink
use getExternalLabel in hnswalg_static (antgroup#237)
Browse files Browse the repository at this point in the history
Signed-off-by: LHT129 <[email protected]>
  • Loading branch information
LHT129 authored Dec 20, 2024
1 parent 22dccdb commit 8f939f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/algorithm/hnswlib/hnswalg_static.h
Original file line number Diff line number Diff line change
Expand Up @@ -1591,12 +1591,12 @@ class StaticHierarchicalNSW : public AlgorithmInterface<float> {
for (uint32_t i = 0; i < cur_element_count_; i++) {
float dist = fstdistfunc_(data_point, getDataByInternalId(i), dist_func_param_);
if (results.size() < k) {
results.push({dist, *getExternalLabeLp(i)});
results.push({dist, getExternalLabel(i)});
} else {
float current_max_dist = results.top().first;
if (dist < current_max_dist) {
results.pop();
results.push({dist, *getExternalLabeLp(i)});
results.push({dist, getExternalLabel(i)});
}
}
}
Expand Down

0 comments on commit 8f939f1

Please sign in to comment.