From ed0ff4755189381b5f94e464c2c2d625811cbcd2 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Wed, 7 Jun 2023 10:33:11 +0200 Subject: [PATCH] Return an empty list of results if attribute is set as filterable --- milli/src/search/mod.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index af5f3415c..2f0edc226 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -14,8 +14,7 @@ use crate::error::UserError; use crate::heed_codec::facet::{FacetGroupKey, FacetGroupValue}; use crate::score_details::{ScoreDetails, ScoringStrategy}; use crate::{ - execute_search, AscDesc, DefaultSearchLogger, DocumentId, FieldIdMapMissingEntry, Index, - Result, SearchContext, BEU16, + execute_search, AscDesc, DefaultSearchLogger, DocumentId, Index, Result, SearchContext, BEU16, }; // Building these factories is not free. @@ -275,13 +274,9 @@ impl<'a> SearchForFacetValues<'a> { let fields_ids_map = index.fields_ids_map(rtxn)?; let fid = match fields_ids_map.id(&self.facet) { Some(fid) => fid, - None => { - return Err(FieldIdMapMissingEntry::FieldName { - field_name: self.facet.clone(), - process: "search for facet values", - } - .into()); - } + // we return an empty list of results when the attribute has been + // set as filterable but no document contains this field (yet). + None => return Ok(Vec::new()), }; let fst = match self.search_query.index.facet_id_string_fst.get(rtxn, &BEU16::new(fid))? {