4646: Reduce `Transform`'s disk usage r=Kerollmops a=Kerollmops

This PR implements what is described in #4485. It reduces the number of disk writes and disk usage.

Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
meili-bors[bot] 2024-05-23 16:06:50 +00:00 committed by GitHub
commit 19acc65ad2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 197 additions and 103 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 {