From 3d2c204f2d528040f6775ae0102666aa5e6987f6 Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 5 Aug 2025 11:26:10 +0200 Subject: [PATCH] Update crates/milli/src/search/facet/filter.rs --- crates/milli/src/search/facet/filter.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/milli/src/search/facet/filter.rs b/crates/milli/src/search/facet/filter.rs index 4d1e51767..803a0635b 100644 --- a/crates/milli/src/search/facet/filter.rs +++ b/crates/milli/src/search/facet/filter.rs @@ -433,8 +433,9 @@ impl<'a> Filter<'a> { } }; - if *last == 255 { - // The prefix is invalid utf8, so no documents will match anyway + if *last == u8::MAX { + // u8::MAX is a forbidden UTF-8 byte, we're guaranteed it cannot be sent through a filter to meilisearch, but just in case, we're going to return something + tracing::warn!("Found non utf-8 character in filter. That shouldn't be possible"); return Ok(RoaringBitmap::new()); } *last += 1;