mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-09 22:48:54 +01:00
skip normalization when the locales and values are the same
This commit is contained in:
parent
25791e3f46
commit
8acd3f50bb
@ -68,10 +68,18 @@ pub fn extract_facet_string_docids<R: io::Read + io::Seek>(
|
|||||||
|
|
||||||
// Facet search normalization
|
// Facet search normalization
|
||||||
{
|
{
|
||||||
let locales = settings_diff.old.localized_faceted_fields_ids.locales(field_id);
|
let old_locales = settings_diff.old.localized_faceted_fields_ids.locales(field_id);
|
||||||
let old_hyper_normalized_value = normalize_facet_string(normalized_value, locales);
|
let new_locales = settings_diff.new.localized_faceted_fields_ids.locales(field_id);
|
||||||
let locales = settings_diff.new.localized_faceted_fields_ids.locales(field_id);
|
|
||||||
let new_hyper_normalized_value = normalize_facet_string(normalized_value, locales);
|
if is_same_value && old_locales == new_locales {
|
||||||
|
// optimization: skip costly normalizations if the values and locales stayed the same
|
||||||
|
// TODO: splitting the cases between a settings diff and a document update would possibly allow for more optimizations,
|
||||||
|
// such as skipping the locales check when doing a documents update.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let old_hyper_normalized_value = normalize_facet_string(normalized_value, old_locales);
|
||||||
|
let new_hyper_normalized_value = normalize_facet_string(normalized_value, new_locales);
|
||||||
|
|
||||||
let set = BTreeSet::from_iter(std::iter::once(normalized_value));
|
let set = BTreeSet::from_iter(std::iter::once(normalized_value));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user