From bad8ea47d5884eaf862adacf33377bf8d8672049 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 8 Sep 2021 18:12:10 +0200 Subject: [PATCH] edit the two lasts TODO comments --- milli/src/update/index_documents/extract/extract_geo_points.rs | 3 ++- milli/src/update/index_documents/mod.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/milli/src/update/index_documents/extract/extract_geo_points.rs b/milli/src/update/index_documents/extract/extract_geo_points.rs index c4bdce211..1af22d010 100644 --- a/milli/src/update/index_documents/extract/extract_geo_points.rs +++ b/milli/src/update/index_documents/extract/extract_geo_points.rs @@ -33,7 +33,8 @@ pub fn extract_geo_points( let bytes: [u8; 16] = concat_arrays![lat.to_ne_bytes(), lng.to_ne_bytes()]; writer.insert(docid_bytes, bytes)?; } else { - let primary_key = obkv.get(primary_key_id).unwrap(); // TODO: TAMO: is this valid? + // All document must have a primary key so we can unwrap safely here + let primary_key = obkv.get(primary_key_id).unwrap(); let primary_key = serde_json::from_slice(primary_key).map_err(InternalError::SerdeJson)?; Err(UserError::InvalidGeoField { document_id: primary_key, object: point })? diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index 38eea954b..d3b8e47b0 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -229,7 +229,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> { ) = crossbeam_channel::unbounded(); // get the primary key field id - let primary_key_id = fields_ids_map.id(&primary_key).unwrap(); // TODO: TAMO: is this unwrap 100% valid? + let primary_key_id = fields_ids_map.id(&primary_key).unwrap(); // get searchable fields for word databases let searchable_fields =