Minor changes in API response field names.

This commit is contained in:
Kishore Nallan 2017-10-14 09:51:36 +05:30
parent bb3ca4211a
commit 8644fa5d79
2 changed files with 4 additions and 3 deletions

View File

@ -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());

View File

@ -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);