add a bunch of tests and fix the error message when adding the geosearch as filterable/sortable while there is malformed documents in the DB

This commit is contained in:
Tamo 2024-01-17 15:51:52 +01:00
parent 3b8a9597e2
commit 7d190d8078
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 180 additions and 3 deletions

View file

@ -34,8 +34,10 @@ pub fn extract_geo_points<R: io::Read + io::Seek>(
// since we only need the primary key when we throw an error
// we create this getter to lazily get it when needed
let document_id = || -> Value {
let document_id = obkv.get(primary_key_id).unwrap();
serde_json::from_slice(document_id).unwrap()
let reader = KvReaderDelAdd::new(obkv.get(primary_key_id).unwrap());
let document_id =
reader.get(DelAdd::Deletion).or(reader.get(DelAdd::Addition)).unwrap();
serde_json::from_slice(&document_id).unwrap()
};
// first we get the two fields