mirror of
https://github.com/typesense/typesense.git
synced 2025-05-17 12:12:35 +08:00
Return json object rather than string for convenience.
This commit is contained in:
parent
2952b0d461
commit
9f788546c8
@ -66,7 +66,7 @@ struct override_t {
|
||||
}
|
||||
}
|
||||
|
||||
std::string to_json_str() const {
|
||||
nlohmann::json to_json() const {
|
||||
nlohmann::json override;
|
||||
override["id"] = id;
|
||||
override["rule"]["query"] = rule.query;
|
||||
@ -88,7 +88,7 @@ struct override_t {
|
||||
override["excludes"].push_back(exclude);
|
||||
}
|
||||
|
||||
return override.dump();
|
||||
return override;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -932,7 +932,7 @@ Option<uint32_t> Collection::add_override(const override_t & override) {
|
||||
return Option<uint32_t>(409, "There is already another entry with that `id`.");
|
||||
}
|
||||
|
||||
bool inserted = store->insert(Collection::get_override_key(name, override.id), override.to_json_str());
|
||||
bool inserted = store->insert(Collection::get_override_key(name, override.id), override.to_json().dump());
|
||||
if(!inserted) {
|
||||
return Option<uint32_t>(500, "Error while storing the override on disk.");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user