Log an error when a facet value is missing from the database

This commit is contained in:
Clément Renault 2023-04-27 10:50:42 +02:00 committed by Louis Dureuil
parent 55c17aa38b
commit 8e86eb91bb
No known key found for this signature in database

View File

@ -3,6 +3,7 @@ use std::fmt;
use fst::automaton::{Complement, Intersection, StartsWith, Str, Union}; use fst::automaton::{Complement, Intersection, StartsWith, Str, Union};
use fst::Streamer; use fst::Streamer;
use levenshtein_automata::{LevenshteinAutomatonBuilder as LevBuilder, DFA}; use levenshtein_automata::{LevenshteinAutomatonBuilder as LevBuilder, DFA};
use log::{debug, error};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use roaring::bitmap::RoaringBitmap; use roaring::bitmap::RoaringBitmap;
@ -306,7 +307,10 @@ impl<'a> SearchForFacetValues<'a> {
let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value }; let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value };
let docids = match index.facet_id_string_docids.get(rtxn, &key)? { let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
Some(FacetGroupValue { bitmap, .. }) => bitmap, 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); let count = search_candidates.intersection_len(&docids);
if count != 0 { if count != 0 {
@ -329,7 +333,10 @@ impl<'a> SearchForFacetValues<'a> {
let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value }; let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value };
let docids = match index.facet_id_string_docids.get(rtxn, &key)? { let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
Some(FacetGroupValue { bitmap, .. }) => bitmap, 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); let count = search_candidates.intersection_len(&docids);
if count != 0 { if count != 0 {