Fix test on locales

This commit is contained in:
ManyTheFish 2024-11-14 15:45:04 +01:00
parent 91c58cfa38
commit 4ff2b3c2ee

View File

@ -35,8 +35,8 @@ impl<'a> DocumentTokenizer<'a> {
for entry in document.iter_top_level_fields() { for entry in document.iter_top_level_fields() {
let (field_name, value) = entry?; let (field_name, value) = entry?;
let mut tokenize_field = |name: &str, value: &Value| { let mut tokenize_field = |field_name: &str, value: &Value| {
let Some(field_id) = field_id_map.id_or_insert(name) else { let Some(field_id) = field_id_map.id_or_insert(field_name) else {
return Err(UserError::AttributeLimitReached.into()); return Err(UserError::AttributeLimitReached.into());
}; };
@ -52,7 +52,7 @@ impl<'a> DocumentTokenizer<'a> {
Value::Number(n) => { Value::Number(n) => {
let token = n.to_string(); let token = n.to_string();
if let Ok(position) = (*position).try_into() { if let Ok(position) = (*position).try_into() {
token_fn(name, field_id, position, token.as_str())?; token_fn(field_name, field_id, position, token.as_str())?;
} }
Ok(()) Ok(())
@ -76,7 +76,7 @@ impl<'a> DocumentTokenizer<'a> {
if !token.is_empty() && token.len() <= MAX_WORD_LENGTH { if !token.is_empty() && token.len() <= MAX_WORD_LENGTH {
*position = index; *position = index;
if let Ok(position) = (*position).try_into() { if let Ok(position) = (*position).try_into() {
token_fn(name, field_id, position, token)?; token_fn(field_name, field_id, position, token)?;
} }
} }
} }