From 01675771d5e82b36dbee2bb8f9e61a33b0349f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 14 Jun 2022 15:08:40 +0200 Subject: [PATCH] Reimplement `!=` filter to select all docids not selected by `=` --- milli/src/search/facet/filter.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/milli/src/search/facet/filter.rs b/milli/src/search/facet/filter.rs index d14b33f80..371cf975e 100644 --- a/milli/src/search/facet/filter.rs +++ b/milli/src/search/facet/filter.rs @@ -309,11 +309,12 @@ impl<'a> Filter<'a> { return Ok(string_docids | number_docids); } Condition::NotEqual(val) => { - let all_numbers_ids = index.number_faceted_documents_ids(rtxn, field_id)?; - let all_strings_ids = index.string_faceted_documents_ids(rtxn, field_id)?; let operator = Condition::Equal(val.clone()); - let docids = Self::evaluate_operator(rtxn, index, field_id, &operator)?; - return Ok((all_numbers_ids | all_strings_ids) - docids); + let docids = Self::evaluate_operator( + rtxn, index, field_id, &operator, + )?; + let all_ids = index.documents_ids(rtxn)?; + return Ok(all_ids - docids); } };