Repository: meilisearch/meilisearch
File: milli/src/update/settings.rs (Rust)

Code before:
            return true;
        }

        let faceted_updated =
            (existing_fields - old_faceted_fields) != (existing_fields - new_faceted_fields);

        self.old
            .fields_ids_map
            .iter()
            .zip(self.new.fields_ids_map.iter())
            .any(|(old, new)| old != new)
            || faceted_updated
    }

    pub fn reindex_vectors(&self) -> bool {
        self.embedding_configs_updated
    }

    pub fn settings_update_only(&self) -> bool {
        self.settings_update_only
    }
}

#[derive(Clone)]
pub(crate) struct InnerIndexSettings {
    pub stop_words: Option<fst::Set<Vec<u8>>>,
    pub allowed_separators: Option<BTreeSet<String>>,
    pub dictionary: Option<BTreeSet<String>>,
    pub fields_ids_map: FieldsIdsMap,
    pub user_defined_faceted_fields: HashSet<String>,
    pub user_defined_searchable_fields: Option<Vec<String>>,
    pub faceted_fields_ids: HashSet<FieldId>,
    pub searchable_fields_ids: Option<Vec<FieldId>>,
    pub exact_attributes: HashSet<FieldId>,
    pub proximity_precision: ProximityPrecision,
    pub embedding_configs: EmbeddingConfigs,
    pub existing_fields: HashSet<String>,
}

impl InnerIndexSettings {
    pub fn from_index(index: &Index, rtxn: &heed::RoTxn) -> Result<Self> {
        let stop_words = index.stop_words(rtxn)?;
        let stop_words = stop_words.map(|sw| sw.map_data(Vec::from).unwrap());
        let allowed_separators = index.allowed_separators(rtxn)?;
        let dictionary = index.dictionary(rtxn)?;
        let fields_ids_map = index.fields_ids_map(rtxn)?;
        let user_defined_searchable_fields = index.user_defined_searchable_fields(rtxn)?;
        let user_defined_searchable_fields =
            user_defined_searchable_fields.map(|sf| sf.into_iter().map(String::from).collect());
        let user_defined_faceted_fields = index.user_defined_faceted_fields(rtxn)?;
        let searchable_fields_ids = index.searchable_fields_ids(rtxn)?;

Review comment (suggestion):
Shouldn’t we ensure that we went from « not faceted » to « faceted » instead of checking if we're only updating the settings?
It seems more future-proof, but maybe I’m missing something? 🤔 

```suggestion
    pub fn run_geo_indexing(&self) -> bool {
        self.old.geo_fields_ids != self.new.geo_fields_ids
            || (!self.old.geo_fields_ids.is_none() && self.new.geo_fields_ids.is_some())
    }
```

Code after:
            return true;
        }

        let faceted_updated =
            (existing_fields - old_faceted_fields) != (existing_fields - new_faceted_fields);

        self.old
            .fields_ids_map
            .iter()
            .zip(self.new.fields_ids_map.iter())
            .any(|(old, new)| old != new)
            || faceted_updated
    }

    pub fn reindex_vectors(&self) -> bool {
        self.embedding_configs_updated
    }

    pub fn settings_update_only(&self) -> bool {
        self.settings_update_only
    }

    pub fn run_geo_indexing(&self) -> bool {
        self.old.geo_fields_ids != self.new.geo_fields_ids
            || (!self.settings_update_only && self.new.geo_fields_ids.is_some())
    }
}

#[derive(Clone)]
pub(crate) struct InnerIndexSettings {
    pub stop_words: Option<fst::Set<Vec<u8>>>,
    pub allowed_separators: Option<BTreeSet<String>>,
    pub dictionary: Option<BTreeSet<String>>,
    pub fields_ids_map: FieldsIdsMap,
    pub user_defined_faceted_fields: HashSet<String>,
    pub user_defined_searchable_fields: Option<Vec<String>>,
    pub faceted_fields_ids: HashSet<FieldId>,
    pub searchable_fields_ids: Option<Vec<FieldId>>,
    pub exact_attributes: HashSet<FieldId>,
    pub proximity_precision: ProximityPrecision,
    pub embedding_configs: EmbeddingConfigs,
    pub existing_fields: HashSet<String>,
    pub geo_fields_ids: Option<(FieldId, FieldId)>,
}

impl InnerIndexSettings {
    pub fn from_index(index: &Index, rtxn: &heed::RoTxn) -> Result<Self> {
        let stop_words = index.stop_words(rtxn)?;
        let stop_words = stop_words.map(|sw| sw.map_data(Vec::from).unwrap());
        let allowed_separators = index.allowed_separators(rtxn)?;
        let dictionary = index.dictionary(rtxn)?;