mirror of
https://github.com/typesense/typesense.git
synced 2025-05-22 06:40:30 +08:00
fix float value truncation bug & compile fix
This commit is contained in:
parent
741705b367
commit
09b7c19953
@ -2871,13 +2871,9 @@ bool Collection::facet_value_to_string(const facet &a_facet, const facet_count_t
|
||||
} else if(search_schema.at(a_facet.field_name).type == field_types::FLOAT) {
|
||||
float raw_val = document[a_facet.field_name].get<float>();
|
||||
value = StringUtils::float_to_str(raw_val);
|
||||
if(value != "0") {
|
||||
value.erase ( value.find_last_not_of('0') + 1, std::string::npos ); // remove trailing zeros
|
||||
}
|
||||
} else if(search_schema.at(a_facet.field_name).type == field_types::FLOAT_ARRAY) {
|
||||
float raw_val = document[a_facet.field_name][facet_count.array_pos].get<float>();
|
||||
value = StringUtils::float_to_str(raw_val);
|
||||
value.erase ( value.find_last_not_of('0') + 1, std::string::npos ); // remove trailing zeros
|
||||
} else if(search_schema.at(a_facet.field_name).type == field_types::BOOL) {
|
||||
value = std::to_string(document[a_facet.field_name].get<bool>());
|
||||
value = (value == "1") ? "true" : "false";
|
||||
|
@ -395,12 +395,6 @@ int run_server(const Config & config, const std::string & version, void (*master
|
||||
// meta DB for storing house keeping things
|
||||
Store meta_store(meta_dir, 24*60*60, 1024, false);
|
||||
|
||||
//analytics DB for storing query click events
|
||||
std::unique_ptr<Store> analytics_store = nullptr;
|
||||
if(!analytics_dir.empty()) {
|
||||
analytics_store.reset(new Store(analytics_dir, 24 * 60 * 60, 1024, true, config.get_db_compaction_interval()));
|
||||
}
|
||||
|
||||
curl_global_init(CURL_GLOBAL_SSL);
|
||||
HttpClient & httpClient = HttpClient::get_instance();
|
||||
httpClient.init(config.get_api_key());
|
||||
|
Loading…
x
Reference in New Issue
Block a user