mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-12-08 21:55:42 +00:00
Make sure we don't crash on unreferenced fields
This commit is contained in:
committed by
Kerollmops
parent
5d94d82d1f
commit
c8ed1158c4
@@ -509,8 +509,9 @@ where
|
||||
let new_searchable_attributes = settings_delta.new_searchable_attributes().as_ref();
|
||||
old_searchable_attributes.zip(new_searchable_attributes).map(|(old, new)| {
|
||||
old.iter()
|
||||
.filter(|field_name| !new.contains(field_name))
|
||||
.map(|field_name| fields_ids_map.id(field_name).unwrap())
|
||||
// Ignore the field if it is not searchable anymore
|
||||
// or if it was never referenced in any document
|
||||
.filter_map(|name| if new.contains(name) { None } else { fields_ids_map.id(name) })
|
||||
.collect()
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user