Ignore geo fields when the Del and Add content is the same

This commit is contained in:
Kerollmops 2023-10-23 11:54:45 +02:00 committed by Louis Dureuil
parent a3dae4db9b
commit 544440c363
No known key found for this signature in database

View File

@ -60,6 +60,7 @@ 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()?;
if del_lat_lng != add_lat_lng {
let mut obkv = KvWriterDelAdd::memory(); let mut obkv = KvWriterDelAdd::memory();
if let Some([lat, lng]) = del_lat_lng { if let Some([lat, lng]) = del_lat_lng {
#[allow(clippy::drop_non_drop)] #[allow(clippy::drop_non_drop)]
@ -74,6 +75,7 @@ pub fn extract_geo_points<R: io::Read + io::Seek>(
let bytes = obkv.into_inner()?; let bytes = obkv.into_inner()?;
writer.insert(docid_bytes, bytes)?; 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())
} }