Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

fix address sanitizer issue

krunal6b68ac6a5d4c
diff --git a/src/facet_index.cpp b/src/facet_index.cpp
index ff519fe5..9e4d6cd3 100644
--- a/src/facet_index.cpp
+++ b/src/facet_index.cpp
@@ -123,16 +123,16 @@ void facet_index_t::remove(const std::string& field_name, const uint32_t seq_id)
ids_t::destroy_list(ids);
std::string dead_fvalue;
dead_fvalues.push_back(dead_fvalue);
- count_list.erase(facet_ids_seq_ids->second.facet_count_it);
- auto node = facet_index_map.extract(facet_ids_seq_ids->first);
- node.key() = dead_fvalue;
- facet_index_map.insert(std::move(node));
- //remove from int64 lookup map
+ //remove from int64 lookup map first
auto& fhash_int64_map = facet_field_it->second.fhash_to_int64_map;
uint32_t fhash = facet_ids_seq_ids->second.facet_id;
-
fhash_int64_map.erase(fhash);
+
+ count_list.erase(facet_ids_seq_ids->second.facet_count_it);
+ auto node = facet_index_map.extract(facet_ids_seq_ids->first);
+ node.key() = dead_fvalue;
+ facet_index_map.insert(std::move(node));
}
}
}