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

Minor changes in API response field names.

Kishore Nallan8644fa5d7979
diff --git a/src/api.cpp b/src/api.cpp
index 6931a662..46b6ef54 100644
--- a/src/api.cpp
+++ b/src/api.cpp
@@ -16,7 +16,8 @@ void get_collections(http_req & req, http_res & res) {
for(Collection* collection: collections) {
nlohmann::json collection_map;
collection_map["name"] = collection->get_name();
- json_response["data"].push_back(collection_map);
+ collection_map["num_documents"] = collection->get_num_documents();
+ json_response["collections"].push_back(collection_map);
}
res.send_200(json_response.dump());
diff --git a/src/collection.cpp b/src/collection.cpp
index 369b84e6..318b12c9 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -861,8 +861,8 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<s
snippet_stream << tokens[snippet_index];
}
- document["_snippets"] = nlohmann::json::object();
- document["_snippets"][field_name] = snippet_stream.str();
+ document["_highlight"] = nlohmann::json::object();
+ document["_highlight"][field_name] = snippet_stream.str();
}
result["hits"].push_back(document);