From ab09dc0167162752620546a8b12466273eef6f1b Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 6 Apr 2023 15:59:00 +0200 Subject: [PATCH] exact_attributes: Add TODOs and additional check after review --- milli/src/search/new/exact_attribute.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/milli/src/search/new/exact_attribute.rs b/milli/src/search/new/exact_attribute.rs index b82a60597..3a31f6a75 100644 --- a/milli/src/search/new/exact_attribute.rs +++ b/milli/src/search/new/exact_attribute.rs @@ -166,6 +166,9 @@ impl State { ) .unwrap_or_default(); candidates &= word_position_docids; + if candidates.is_empty() { + return Ok(State::Empty(query_graph.clone())); + } } } @@ -197,11 +200,15 @@ impl State { )?; intersection &= &candidates; if !intersection.is_empty() { + // TODO: although not really worth it in terms of performance, + // if would be good to put this in cache for the sake of consistency let candidates_with_exact_word_count = ctx .index .field_id_word_count_docids .get(ctx.txn, &(fid, exact_term_position_ids.len() as u8))? .unwrap_or_default(); + // TODO: consider if we must store the candidates as arrays, or if there is a way to perform the union + // here. candidates_per_attribute.push(FieldCandidates { start_with_exact: intersection, exact_word_count: candidates_with_exact_word_count,