mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-18 08:48:32 +08:00
Change the time measurement of the query
This commit is contained in:
parent
064cfa4755
commit
9790c393a0
@ -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.map_err(|e| Error::Internal(e.to_string()))?;
|
||||||
let ranked_map = ranked_map.unwrap_or_default();
|
let ranked_map = ranked_map.unwrap_or_default();
|
||||||
|
|
||||||
let start = Instant::now();
|
|
||||||
|
|
||||||
// Change criteria
|
// Change criteria
|
||||||
let mut query_builder = match self.get_criteria(reader, &ranked_map, &schema)? {
|
let mut query_builder = match self.get_criteria(reader, &ranked_map, &schema)? {
|
||||||
Some(criteria) => self.index.query_builder_with_criteria(criteria),
|
Some(criteria) => self.index.query_builder_with_criteria(criteria),
|
||||||
@ -222,8 +220,9 @@ impl<'a> SearchBuilder<'a> {
|
|||||||
|
|
||||||
query_builder.with_fetch_timeout(self.timeout);
|
query_builder.with_fetch_timeout(self.timeout);
|
||||||
|
|
||||||
let docs =
|
let start = Instant::now();
|
||||||
query_builder.query(reader, &self.query, self.offset..(self.offset + self.limit));
|
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);
|
let mut hits = Vec::with_capacity(self.limit);
|
||||||
for doc in docs.map_err(|e| Error::SearchDocuments(e.to_string()))? {
|
for doc in docs.map_err(|e| Error::SearchDocuments(e.to_string()))? {
|
||||||
@ -278,8 +277,6 @@ impl<'a> SearchBuilder<'a> {
|
|||||||
hits.push(hit);
|
hits.push(hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
let time_ms = start.elapsed().as_millis() as usize;
|
|
||||||
|
|
||||||
let results = SearchResult {
|
let results = SearchResult {
|
||||||
hits,
|
hits,
|
||||||
offset: self.offset,
|
offset: self.offset,
|
||||||
|
Loading…
Reference in New Issue
Block a user