Repository: meilisearch/meilisearch
File: crates/milli/src/update/new/extract/faceted/extract_facets.rs (Rust)

Code before:

                // 1. Maybe update doc
                if has_changed_for_facets {
                    extract_document_facets(
                        inner.current(rtxn, index, context.db_fields_ids_map)?,
                        new_fields_ids_map.deref_mut(),
                        filterable_attributes,
                        sortable_fields,
                        asc_desc_fields,
                        distinct_field,
                        &mut facet_fn!(del),
                    )?;

                    extract_document_facets(
                        inner.merged(rtxn, index, context.db_fields_ids_map)?,
                        new_fields_ids_map.deref_mut(),
                        filterable_attributes,
                        sortable_fields,
                        asc_desc_fields,
                        distinct_field,
                        &mut facet_fn!(add),
                    )?;
                }

                // 2. Maybe update geo
                if is_geo_enabled && has_changed_for_geo_fields {
                    extract_geo_document(
                        inner.current(rtxn, index, context.db_fields_ids_map)?,
                        inner.external_document_id(),
                        new_fields_ids_map.deref_mut(),
                        &mut facet_fn!(del),
                    )?;
                    extract_geo_document(
                        inner.merged(rtxn, index, context.db_fields_ids_map)?,
                        inner.external_document_id(),
                        new_fields_ids_map.deref_mut(),
                        &mut facet_fn!(add),
                    )?;
                }
            }
            DocumentChange::Insertion(inner) => {
                let mut add = facet_fn!(add);

                extract_document_facets(
                    inner.inserted(),
                    new_fields_ids_map.deref_mut(),
                    filterable_attributes,
                    sortable_fields,
                    asc_desc_fields,
                    distinct_field,
                    &mut add,

Review comment (suggestion):
```suggestion
                if is_geo_enabled && inner.has_changed_for_geo_fields(rtxn, index, context.db_fields_ids_map)? {
```

Code after:
                // 1. Maybe update doc
                if has_changed_for_facets {
                    extract_document_facets(
                        inner.current(rtxn, index, context.db_fields_ids_map)?,
                        new_fields_ids_map.deref_mut(),
                        filterable_attributes,
                        sortable_fields,
                        asc_desc_fields,
                        distinct_field,
                        &mut facet_fn!(del),
                    )?;

                    extract_document_facets(
                        inner.merged(rtxn, index, context.db_fields_ids_map)?,
                        new_fields_ids_map.deref_mut(),
                        filterable_attributes,
                        sortable_fields,
                        asc_desc_fields,
                        distinct_field,
                        &mut facet_fn!(add),
                    )?;
                }

                // 2. Maybe update geo
                if is_geo_enabled
                    && inner.has_changed_for_geo_fields(rtxn, index, context.db_fields_ids_map)?
                {
                    extract_geo_document(
                        inner.current(rtxn, index, context.db_fields_ids_map)?,
                        inner.external_document_id(),
                        new_fields_ids_map.deref_mut(),
                        &mut facet_fn!(del),
                    )?;
                    extract_geo_document(
                        inner.merged(rtxn, index, context.db_fields_ids_map)?,
                        inner.external_document_id(),
                        new_fields_ids_map.deref_mut(),
                        &mut facet_fn!(add),
                    )?;
                }
            }
            DocumentChange::Insertion(inner) => {
                let mut add = facet_fn!(add);

                extract_document_facets(
                    inner.inserted(),
                    new_fields_ids_map.deref_mut(),
                    filterable_attributes,
                    sortable_fields,
                    asc_desc_fields,
                    distinct_field,