From 2bd5d2474ed6783839a3fdb3c57a88480552fe21 Mon Sep 17 00:00:00 2001 From: mpostma Date: Thu, 10 Dec 2020 15:57:19 +0100 Subject: [PATCH] fix attributes to retrieve bug --- meilisearch-http/src/helpers/meilisearch.rs | 4 +--- meilisearch-http/src/routes/search.rs | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/meilisearch-http/src/helpers/meilisearch.rs b/meilisearch-http/src/helpers/meilisearch.rs index 749fe410e..42d5ca550 100644 --- a/meilisearch-http/src/helpers/meilisearch.rs +++ b/meilisearch-http/src/helpers/meilisearch.rs @@ -193,9 +193,7 @@ impl<'a> SearchBuilder<'a> { .index .document(reader, Some(&all_attributes), doc.id) .map_err(|e| Error::retrieve_document(doc.id.0, e))? - .ok_or(Error::internal( - "Impossible to retrieve the document; Corrupted data", - ))?; + .unwrap_or_default(); let mut formatted = document.iter() .filter(|(key, _)| all_formatted.contains(key.as_str())) diff --git a/meilisearch-http/src/routes/search.rs b/meilisearch-http/src/routes/search.rs index 3cd3c3f60..52bbc31f0 100644 --- a/meilisearch-http/src/routes/search.rs +++ b/meilisearch-http/src/routes/search.rs @@ -130,12 +130,13 @@ impl SearchQuery { restricted_attributes = available_attributes.clone(); } else { restricted_attributes = HashSet::new(); + search_builder.attributes_to_retrieve(HashSet::new()); for attr in attributes_to_retrieve { if available_attributes.contains(attr) { restricted_attributes.insert(attr); search_builder.add_retrievable_field(attr.to_string()); } else { - warn!("The attributes {:?} present in attributesToCrop parameter doesn't exist", attr); + warn!("The attributes {:?} present in attributesToRetrieve parameter doesn't exist", attr); } } }