From 8e86eb91bbb85402efa02f0fd7d26ac5676a5556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 27 Apr 2023 10:50:42 +0200 Subject: [PATCH] Log an error when a facet value is missing from the database --- milli/src/search/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index 77f9ce0b8..114ca2a04 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -3,6 +3,7 @@ use std::fmt; use fst::automaton::{Complement, Intersection, StartsWith, Str, Union}; use fst::Streamer; use levenshtein_automata::{LevenshteinAutomatonBuilder as LevBuilder, DFA}; +use log::{debug, error}; use once_cell::sync::Lazy; use roaring::bitmap::RoaringBitmap; @@ -306,7 +307,10 @@ impl<'a> SearchForFacetValues<'a> { let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value }; let docids = match index.facet_id_string_docids.get(rtxn, &key)? { Some(FacetGroupValue { bitmap, .. }) => bitmap, - None => todo!("return an internal error"), + None => { + error!("the facet value is missing from the facet database: {key:?}"); + continue; + } }; let count = search_candidates.intersection_len(&docids); if count != 0 { @@ -329,7 +333,10 @@ impl<'a> SearchForFacetValues<'a> { let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value }; let docids = match index.facet_id_string_docids.get(rtxn, &key)? { Some(FacetGroupValue { bitmap, .. }) => bitmap, - None => todo!("return an internal error"), + None => { + error!("the facet value is missing from the facet database: {key:?}"); + continue; + } }; let count = search_candidates.intersection_len(&docids); if count != 0 {