mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 12:35:05 +08:00
rename all the ’long’ into ’lng’ like written in the specification
This commit is contained in:
parent
3b9f1db061
commit
b4b6ba6d82
@ -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 = 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)?;
|
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)
|
// 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)?;
|
writer.insert(docid_bytes, bytes)?;
|
||||||
} else {
|
} else {
|
||||||
// TAMO: improve the warn
|
// TAMO: improve the warn
|
||||||
|
@ -189,8 +189,8 @@ pub(crate) fn write_typed_chunk_into_index(
|
|||||||
|
|
||||||
// convert the latitude and longitude back to a f64 (8 bytes)
|
// convert the latitude and longitude back to a f64 (8 bytes)
|
||||||
let (lat, tail) = helpers::try_split_array_at::<u8, 8>(value).unwrap();
|
let (lat, tail) = helpers::try_split_array_at::<u8, 8>(value).unwrap();
|
||||||
let (long, _) = helpers::try_split_array_at::<u8, 8>(tail).unwrap();
|
let (lng, _) = helpers::try_split_array_at::<u8, 8>(tail).unwrap();
|
||||||
let point = [f64::from_le_bytes(lat), f64::from_le_bytes(long)];
|
let point = [f64::from_le_bytes(lat), f64::from_le_bytes(lng)];
|
||||||
rtree.insert(GeoPoint::new(point, key));
|
rtree.insert(GeoPoint::new(point, key));
|
||||||
}
|
}
|
||||||
index.put_geo_rtree(wtxn, &rtree)?;
|
index.put_geo_rtree(wtxn, &rtree)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user