mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-17 08:10:14 +08:00
Ignore geo fields when the Del and Add content is the same
This commit is contained in:
parent
a3dae4db9b
commit
544440c363
@ -60,19 +60,21 @@ pub fn extract_geo_points<R: io::Read + io::Seek>(
|
|||||||
.map(|(lat, lng)| extract_lat_lng(lat, lng, document_id))
|
.map(|(lat, lng)| extract_lat_lng(lat, lng, document_id))
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
let mut obkv = KvWriterDelAdd::memory();
|
if del_lat_lng != add_lat_lng {
|
||||||
if let Some([lat, lng]) = del_lat_lng {
|
let mut obkv = KvWriterDelAdd::memory();
|
||||||
#[allow(clippy::drop_non_drop)]
|
if let Some([lat, lng]) = del_lat_lng {
|
||||||
let bytes: [u8; 16] = concat_arrays![lat.to_ne_bytes(), lng.to_ne_bytes()];
|
#[allow(clippy::drop_non_drop)]
|
||||||
obkv.insert(DelAdd::Deletion, bytes)?;
|
let bytes: [u8; 16] = concat_arrays![lat.to_ne_bytes(), lng.to_ne_bytes()];
|
||||||
|
obkv.insert(DelAdd::Deletion, bytes)?;
|
||||||
|
}
|
||||||
|
if let Some([lat, lng]) = add_lat_lng {
|
||||||
|
#[allow(clippy::drop_non_drop)]
|
||||||
|
let bytes: [u8; 16] = concat_arrays![lat.to_ne_bytes(), lng.to_ne_bytes()];
|
||||||
|
obkv.insert(DelAdd::Addition, bytes)?;
|
||||||
|
}
|
||||||
|
let bytes = obkv.into_inner()?;
|
||||||
|
writer.insert(docid_bytes, bytes)?;
|
||||||
}
|
}
|
||||||
if let Some([lat, lng]) = add_lat_lng {
|
|
||||||
#[allow(clippy::drop_non_drop)]
|
|
||||||
let bytes: [u8; 16] = concat_arrays![lat.to_ne_bytes(), lng.to_ne_bytes()];
|
|
||||||
obkv.insert(DelAdd::Addition, bytes)?;
|
|
||||||
}
|
|
||||||
let bytes = obkv.into_inner()?;
|
|
||||||
writer.insert(docid_bytes, bytes)?;
|
|
||||||
}
|
}
|
||||||
(None, Some(_)) => {
|
(None, Some(_)) => {
|
||||||
return Err(GeoError::MissingLatitude { document_id: document_id() }.into())
|
return Err(GeoError::MissingLatitude { document_id: document_id() }.into())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user