mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-10 05:57:48 +00:00
refactor for readability
This commit is contained in:
parent
18aed75d3b
commit
c9ec502ed9
@ -170,9 +170,7 @@ impl FacetedDocidsExtractor {
|
||||
let has_changed_for_geo_fields =
|
||||
inner.has_changed_for_geo_fields(rtxn, index, context.db_fields_ids_map)?;
|
||||
|
||||
// 1. Delete old facet values
|
||||
let mut del = facet_fn!(del);
|
||||
|
||||
// 1. Maybe update doc
|
||||
if has_changed {
|
||||
extract_document_facets(
|
||||
inner.current(rtxn, index, context.db_fields_ids_map)?,
|
||||
@ -181,22 +179,9 @@ impl FacetedDocidsExtractor {
|
||||
sortable_fields,
|
||||
asc_desc_fields,
|
||||
distinct_field,
|
||||
&mut del,
|
||||
&mut facet_fn!(del),
|
||||
)?;
|
||||
}
|
||||
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 del,
|
||||
)?;
|
||||
}
|
||||
|
||||
// 2. Insert new facet values
|
||||
let mut add = facet_fn!(add);
|
||||
|
||||
if has_changed {
|
||||
extract_document_facets(
|
||||
inner.merged(rtxn, index, context.db_fields_ids_map)?,
|
||||
new_fields_ids_map.deref_mut(),
|
||||
@ -204,15 +189,23 @@ impl FacetedDocidsExtractor {
|
||||
sortable_fields,
|
||||
asc_desc_fields,
|
||||
distinct_field,
|
||||
&mut add,
|
||||
&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 add,
|
||||
&mut facet_fn!(add),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user