From c51dcad51b1d225f24ef5f519c1c94daa7088c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 18 Aug 2022 10:59:21 +0200 Subject: [PATCH] Don't recompute filterable fields in evaluation of IN[] filter --- milli/src/search/facet/filter.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/milli/src/search/facet/filter.rs b/milli/src/search/facet/filter.rs index 487676f4a..2f6fb5b00 100644 --- a/milli/src/search/facet/filter.rs +++ b/milli/src/search/facet/filter.rs @@ -361,10 +361,7 @@ impl<'a> Filter<'a> { return Ok(all_ids - selected); } FilterCondition::In { fid, els } => { - // TODO: this could be optimised - let filterable_fields = index.filterable_fields(rtxn)?; - - if crate::is_faceted(fid.value(), &filterable_fields) { + if crate::is_faceted(fid.value(), filterable_fields) { let field_ids_map = index.fields_ids_map(rtxn)?; if let Some(fid) = field_ids_map.id(fid.value()) { @@ -382,7 +379,7 @@ impl<'a> Filter<'a> { } else { return Err(fid.as_external_error(FilterError::AttributeNotFilterable { attribute: fid.value(), - filterable_fields, + filterable_fields: filterable_fields.clone(), }))?; } }