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

Add guard for collection document counter decrement.

Kishore Nallana3d7b9a24a9d
diff --git a/src/collection.cpp b/src/collection.cpp
index 6bab40d8..81e6f4f9 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -4467,7 +4467,9 @@ void Collection::remove_document(const nlohmann::json & document, const uint32_t
std::unique_lock lock(mutex);
index->remove(seq_id, document, {}, false);
- num_documents -= 1;
+ if(num_documents != 0) {
+ num_documents -= 1;
+ }
}
if(remove_from_store) {