mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
fix logic
This commit is contained in:
parent
6738a4f6ee
commit
18aed75d3b
2 changed files with 31 additions and 31 deletions
|
@ -2039,14 +2039,6 @@ async fn update_documents_with_geo_field() {
|
|||
@r###"
|
||||
{
|
||||
"hits": [
|
||||
{
|
||||
"id": "4",
|
||||
"_geo": {
|
||||
"lat": "4",
|
||||
"lng": "0"
|
||||
},
|
||||
"_geoDistance": 667170
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"_geo": {
|
||||
|
@ -2056,6 +2048,14 @@ async fn update_documents_with_geo_field() {
|
|||
"doggo": "kefir",
|
||||
"_geoDistance": 555975
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"_geo": {
|
||||
"lat": "4",
|
||||
"lng": "0"
|
||||
},
|
||||
"_geoDistance": 667170
|
||||
},
|
||||
{
|
||||
"id": "1"
|
||||
},
|
||||
|
|
|
@ -170,10 +170,10 @@ impl FacetedDocidsExtractor {
|
|||
let has_changed_for_geo_fields =
|
||||
inner.has_changed_for_geo_fields(rtxn, index, context.db_fields_ids_map)?;
|
||||
|
||||
if has_changed {
|
||||
// 1. Delete old facet values
|
||||
let mut del = facet_fn!(del);
|
||||
// 1. Delete old facet values
|
||||
let mut del = facet_fn!(del);
|
||||
|
||||
if has_changed {
|
||||
extract_document_facets(
|
||||
inner.current(rtxn, index, context.db_fields_ids_map)?,
|
||||
new_fields_ids_map.deref_mut(),
|
||||
|
@ -183,19 +183,20 @@ impl FacetedDocidsExtractor {
|
|||
distinct_field,
|
||||
&mut 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,
|
||||
)?;
|
||||
}
|
||||
|
||||
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);
|
||||
// 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(),
|
||||
|
@ -205,15 +206,14 @@ impl FacetedDocidsExtractor {
|
|||
distinct_field,
|
||||
&mut add,
|
||||
)?;
|
||||
|
||||
if is_geo_enabled && has_changed_for_geo_fields {
|
||||
extract_geo_document(
|
||||
inner.merged(rtxn, index, context.db_fields_ids_map)?,
|
||||
inner.external_document_id(),
|
||||
new_fields_ids_map.deref_mut(),
|
||||
&mut add,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
if is_geo_enabled && has_changed_for_geo_fields {
|
||||
extract_geo_document(
|
||||
inner.merged(rtxn, index, context.db_fields_ids_map)?,
|
||||
inner.external_document_id(),
|
||||
new_fields_ids_map.deref_mut(),
|
||||
&mut add,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
DocumentChange::Insertion(inner) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue