mirror of
https://github.com/typesense/typesense.git
synced 2025-05-20 21:52:23 +08:00
Allow out_of
and search_time_ms
to be excluded.
This commit is contained in:
parent
bf475ad55f
commit
29d29e64a4
@ -1158,7 +1158,10 @@ Option<nlohmann::json> Collection::search(const std::string & raw_query, const s
|
||||
nlohmann::json result = nlohmann::json::object();
|
||||
|
||||
result["found"] = total_found;
|
||||
result["out_of"] = num_documents.load();
|
||||
|
||||
if(exclude_fields.count("out_of") == 0) {
|
||||
result["out_of"] = num_documents.load();
|
||||
}
|
||||
|
||||
std::string hits_key = group_limit ? "grouped_hits" : "hits";
|
||||
result[hits_key] = nlohmann::json::array();
|
||||
|
@ -974,7 +974,11 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& re
|
||||
}
|
||||
|
||||
nlohmann::json result = result_op.get();
|
||||
result["search_time_ms"] = timeMillis;
|
||||
|
||||
if(exclude_fields.count("search_time_ms") == 0) {
|
||||
result["search_time_ms"] = timeMillis;
|
||||
}
|
||||
|
||||
result["page"] = std::stoi(req_params[PAGE]);
|
||||
results_json_str = result.dump(-1, ' ', false, nlohmann::detail::error_handler_t::ignore);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user