rename all the ’long’ into ’lng’ like written in the specification

This commit is contained in:
Irevoire 2021-08-25 16:00:25 +02:00 committed by Tamo
parent 3b9f1db061
commit b4b6ba6d82
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
2 changed files with 4 additions and 4 deletions

View File

@ -31,9 +31,9 @@ pub fn extract_geo_points<R: io::Read>(
let point = obkv.get(geo_field_id).unwrap(); // TODO: TAMO where should we handle this error?
let point: Value = serde_json::from_slice(point).map_err(InternalError::SerdeJson)?;
if let Some((lat, long)) = point["lat"].as_f64().zip(point["long"].as_f64()) {
if let Some((lat, lng)) = point["lat"].as_f64().zip(point["lng"].as_f64()) {
// this will create an array of 16 bytes (two 8 bytes floats)
let bytes: [u8; 16] = concat_arrays![lat.to_le_bytes(), long.to_le_bytes()];
let bytes: [u8; 16] = concat_arrays![lat.to_le_bytes(), lng.to_le_bytes()];
writer.insert(docid_bytes, bytes)?;
} else {
// TAMO: improve the warn

View File

@ -189,8 +189,8 @@ pub(crate) fn write_typed_chunk_into_index(
// convert the latitude and longitude back to a f64 (8 bytes)
let (lat, tail) = helpers::try_split_array_at::<u8, 8>(value).unwrap();
let (long, _) = helpers::try_split_array_at::<u8, 8>(tail).unwrap();
let point = [f64::from_le_bytes(lat), f64::from_le_bytes(long)];
let (lng, _) = helpers::try_split_array_at::<u8, 8>(tail).unwrap();
let point = [f64::from_le_bytes(lat), f64::from_le_bytes(lng)];
rtree.insert(GeoPoint::new(point, key));
}
index.put_geo_rtree(wtxn, &rtree)?;