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

Look for path based ID only for update end-point.

Kishore Nallanbbda412cc8e3
diff --git a/src/core_api.cpp b/src/core_api.cpp
index a715cf44..9a5fe56c 100644
--- a/src/core_api.cpp
+++ b/src/core_api.cpp
@@ -736,11 +736,6 @@ bool post_add_document(http_req & req, http_res & res) {
return false;
}
- std::string doc_id;
- if(req.params.count("id") != 0) {
- doc_id = req.params["id"];
- }
-
const bool upsert = (req.params[UPSERT] == "true");
CollectionManager & collectionManager = CollectionManager::get_instance();
@@ -751,7 +746,7 @@ bool post_add_document(http_req & req, http_res & res) {
return false;
}
- Option<nlohmann::json> inserted_doc_op = collection->add(req.body, upsert, doc_id);
+ Option<nlohmann::json> inserted_doc_op = collection->add(req.body, upsert);
if(!inserted_doc_op.ok()) {
res.set(inserted_doc_op.code(), inserted_doc_op.error());
@@ -763,10 +758,7 @@ bool post_add_document(http_req & req, http_res & res) {
}
bool put_upsert_document(http_req & req, http_res & res) {
- std::string doc_id;
- if(req.params.count("id") != 0) {
- doc_id = req.params["id"];
- }
+ std::string doc_id = req.params["id"];
CollectionManager & collectionManager = CollectionManager::get_instance();
Collection* collection = collectionManager.get_collection(req.params["collection"]);