Construct the minimal OBKVs according to the settings diff

This commit is contained in:
Clément Renault 2024-05-22 16:05:55 +02:00
parent bc5663e673
commit fe17c0f52e
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
4 changed files with 122 additions and 64 deletions

View file

@ -354,8 +354,7 @@ pub fn is_faceted(field: &str, faceted_fields: impl IntoIterator<Item = impl AsR
/// assert!(!is_faceted_by("animaux.chien", "animaux.chie"));
/// ```
pub fn is_faceted_by(field: &str, facet: &str) -> bool {
field.starts_with(facet)
&& field[facet.len()..].chars().next().map(|c| c == '.').unwrap_or(true)
field.starts_with(facet) && field[facet.len()..].chars().next().map_or(true, |c| c == '.')
}
pub fn normalize_facet(original: &str) -> String {