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 test for empty vector field insertion + deletion.

Kishore Nallan6d2d44e696bf
diff --git a/test/collection_vector_search_test.cpp b/test/collection_vector_search_test.cpp
index 493847c7..66cd9223 100644
--- a/test/collection_vector_search_test.cpp
+++ b/test/collection_vector_search_test.cpp
@@ -302,6 +302,22 @@ TEST_F(CollectionVectorTest, IndexGreaterThan1KVectors) {
ASSERT_EQ(1500, results["found"].get<size_t>());
}
+TEST_F(CollectionVectorTest, InsertDocWithEmptyVectorAndDelete) {
+ nlohmann::json schema = R"({
+ "name": "coll1",
+ "fields": [
+ {"name": "vec", "type": "float[]", "num_dim": 4, "optional": true}
+ ]
+ })"_json;
+
+ Collection *coll1 = collectionManager.create_collection(schema).get();
+ nlohmann::json doc;
+ doc["id"] = "0";
+ doc["vec"] = {};
+ ASSERT_TRUE(coll1->add(doc.dump()).ok());
+ ASSERT_TRUE(coll1->remove("0").ok());
+}
+
TEST_F(CollectionVectorTest, VecSearchWithFiltering) {
nlohmann::json schema = R"({
"name": "coll1",