Enable new algorithm every time

This commit is contained in:
Mubelotix
2025-07-28 16:28:06 +02:00
parent 691a9ae4b1
commit 224892e692

View File

@ -427,29 +427,26 @@ impl<'a> Filter<'a> {
let value = crate::normalize_facet(word.value()); let value = crate::normalize_facet(word.value());
if value.len() <= 6 { let mut value2 = value.as_bytes().to_owned();
// 6 is abitrary, but it works well in practice if let Some(last) = value2.last_mut() {
let mut value2 = value.as_bytes().to_owned(); if *last != 255 {
if let Some(last) = value2.last_mut() { *last += 1;
if *last != 255 { if let Ok(value2) = String::from_utf8(value2) {
*last += 1; // The idea here is that "STARTS WITH baba" is the same as "baba <= value < babb".
if let Ok(value2) = String::from_utf8(value2) { // We just increase the last letter to find the upper bound.
// The idea here is that "STARTS WITH baba" is the same as "baba <= value < babb". // The result could be invalid utf8, so it can fallback.
// We just increase the last letter to find the upper bound. let mut docids = RoaringBitmap::new();
// The result could be invalid utf8, so it can fallback. find_docids_of_facet_within_bounds(
let mut docids = RoaringBitmap::new(); rtxn,
find_docids_of_facet_within_bounds( strings_db,
rtxn, field_id,
strings_db, &Included(&value),
field_id, &Excluded(&value2),
&Included(&value), universe,
&Excluded(&value2), &mut docids,
universe, )?;
&mut docids,
)?;
return Ok(docids); return Ok(docids);
}
} }
} }
} }