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

Tweak error message.

Kishore Nallan8104ffb583b6
diff --git a/src/collection.cpp b/src/collection.cpp
index ebc89de2..21700d3d 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -2820,8 +2820,8 @@ Option<bool> Collection::validate_alter_payload(nlohmann::json& schema_changes,
}
} else {
// partial update is not supported for now
- return Option<bool>(400, "Field `" + field_name + "` is already part of schema: only "
- "field additions and deletions are supported for now.");
+ return Option<bool>(400, "Field `" + field_name + "` is already part of the schema: To "
+ "change this field, drop it first before adding it back to the schema.");
}
}
}
diff --git a/src/core_api.cpp b/src/core_api.cpp
index c3bdbbd3..a094769e 100644
--- a/src/core_api.cpp
+++ b/src/core_api.cpp
@@ -203,7 +203,7 @@ bool patch_update_collection(const std::shared_ptr<http_req>& req, const std::sh
return false;
}
- res->set_200(req->body);
+ res->set_200(req_json.dump());
return true;
}
diff --git a/test/collection_schema_change_test.cpp b/test/collection_schema_change_test.cpp
index bd7806c2..3e3fcbf4 100644
--- a/test/collection_schema_change_test.cpp
+++ b/test/collection_schema_change_test.cpp
@@ -376,8 +376,8 @@ TEST_F(CollectionSchemaChangeTest, AlterValidations) {
auto alter_op = coll1->alter(schema_changes);
ASSERT_FALSE(alter_op.ok());
- ASSERT_EQ("Field `title` is already part of schema: only field additions and deletions are supported for now.",
- alter_op.error());
+ ASSERT_EQ("Field `title` is already part of the schema: To change this field, drop it first before adding it "
+ "back to the schema.",alter_op.error());
// 2. Bad field format
schema_changes = R"({