Compare commits

..

1 Commits

Author SHA1 Message Date
Louis Dureuil
3c640386af
Merge 91c58cfa38 into 94fb55bb6f 2024-11-14 10:40:21 +00:00

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 = |field_name: &str, value: &Value| { let mut tokenize_field = |name: &str, value: &Value| {
let Some(field_id) = field_id_map.id_or_insert(field_name) else { let Some(field_id) = field_id_map.id_or_insert(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(field_name, field_id, position, token.as_str())?; token_fn(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(field_name, field_id, position, token)?; token_fn(name, field_id, position, token)?;
} }
} }
} }