Skip to content

Commit

Permalink
Merge pull request #473 from ttsugriy/develop
Browse files Browse the repository at this point in the history
[bruteforce] Fix bruteforce removePoint.
  • Loading branch information
yurymalkov authored Jul 4, 2023
2 parents 802a0ec + 70ce84e commit e7c66c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hnswlib/bruteforce.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,16 @@ class BruteforceSearch : public AlgorithmInterface<dist_t> {


void removePoint(labeltype cur_external) {
size_t cur_c = dict_external_to_internal[cur_external];
std::unique_lock<std::mutex> lock(index_lock);

dict_external_to_internal.erase(cur_external);
auto found = dict_external_to_internal.find(cur_external);
if (found == dict_external_to_internal.end()) {
return;
}

dict_external_to_internal.erase(found);

size_t cur_c = found->second;
labeltype label = *((labeltype*)(data_ + size_per_element_ * (cur_element_count-1) + data_size_));
dict_external_to_internal[label] = cur_c;
memcpy(data_ + size_per_element_ * cur_c,
Expand Down

0 comments on commit e7c66c8

Please sign in to comment.