From ea4bd29d1470b9d3b466fd4ae833ca5a63d68b42 Mon Sep 17 00:00:00 2001 From: many Date: Tue, 5 Oct 2021 17:35:07 +0200 Subject: [PATCH] Apply PR comments --- milli/src/search/criteria/attribute.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/milli/src/search/criteria/attribute.rs b/milli/src/search/criteria/attribute.rs index 07b3cf95c..4c433ec28 100644 --- a/milli/src/search/criteria/attribute.rs +++ b/milli/src/search/criteria/attribute.rs @@ -228,7 +228,7 @@ impl<'t> Iterator for QueryPositionIterator<'t> { type Item = heed::Result<(u32, RoaringBitmap)>; fn next(&mut self) -> Option { - // sort inner words from the closest next position to the more far next position. + // sort inner words from the closest next position to the farthest next position. let expected_pos = self .inner .iter_mut() @@ -324,11 +324,12 @@ impl<'t> Branch<'t> { if docids.is_empty() { 0 } else { - qli.peek() - .map(|result| { + match qli.peek() { + Some(result) => { result.as_ref().map(|(next_pos, _)| *next_pos - *pos).unwrap_or(0) - }) - .unwrap_or(u32::MAX) + } + None => u32::MAX, + } } }) .enumerate()