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: test assertions and error messages

Harisaran G7b1148ee45ca
diff --git a/include/field.h b/include/field.h
index a3c03d0b..e36ea77c 100644
--- a/include/field.h
+++ b/include/field.h
@@ -263,9 +263,8 @@ struct field {
"` but is not found in the schema.");
}
- LOG(WARNING) << "Fields size: " << fields.size() << " Field set size: " << field_names.size();
if(field_names.size() != fields.size()) {
- return Option<bool>(400, "Duplicates are not allowed in `fields`");
+ return Option<bool>(400, "There are duplicate field names in the schema.");
}
diff --git a/test/collection_specific_test.cpp b/test/collection_specific_test.cpp
index 5918407b..4470e46a 100644
--- a/test/collection_specific_test.cpp
+++ b/test/collection_specific_test.cpp
@@ -1997,5 +1997,7 @@ TEST_F(CollectionSpecificTest, DuplicateFieldsNotAllowed) {
field("title", field_types::INT32, true),};
Option<Collection*> response = collectionManager.create_collection("collection", 1, fields);
+ ASSERT_EQ(response.error(), "There are duplicate field names in the schema.");
+ ASSERT_EQ(response.code(), 400);
ASSERT_FALSE(response.ok());
}
\ No newline at end of file