From 9790c393a0f60c9418bae6173a2a3a1fefd3ffac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 22 Dec 2019 20:55:11 +0100 Subject: [PATCH] Change the time measurement of the query --- meilisearch-http/src/helpers/meilisearch.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/meilisearch-http/src/helpers/meilisearch.rs b/meilisearch-http/src/helpers/meilisearch.rs index fb995750d..668c53328 100644 --- a/meilisearch-http/src/helpers/meilisearch.rs +++ b/meilisearch-http/src/helpers/meilisearch.rs @@ -170,8 +170,6 @@ impl<'a> SearchBuilder<'a> { let ranked_map = ranked_map.map_err(|e| Error::Internal(e.to_string()))?; let ranked_map = ranked_map.unwrap_or_default(); - let start = Instant::now(); - // Change criteria let mut query_builder = match self.get_criteria(reader, &ranked_map, &schema)? { Some(criteria) => self.index.query_builder_with_criteria(criteria), @@ -222,8 +220,9 @@ impl<'a> SearchBuilder<'a> { query_builder.with_fetch_timeout(self.timeout); - let docs = - query_builder.query(reader, &self.query, self.offset..(self.offset + self.limit)); + let start = Instant::now(); + let docs = query_builder.query(reader, &self.query, self.offset..(self.offset + self.limit)); + let time_ms = start.elapsed().as_millis() as usize; let mut hits = Vec::with_capacity(self.limit); for doc in docs.map_err(|e| Error::SearchDocuments(e.to_string()))? { @@ -278,8 +277,6 @@ impl<'a> SearchBuilder<'a> { hits.push(hit); } - let time_ms = start.elapsed().as_millis() as usize; - let results = SearchResult { hits, offset: self.offset,