mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
Make the RawIndexer index_text method return the number of words
This commit is contained in:
parent
b7ea812dcc
commit
9cdda8c46a
@ -33,7 +33,8 @@ impl RawIndexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index_text(&mut self, id: DocumentId, attr: SchemaAttr, text: &str) {
|
pub fn index_text(&mut self, id: DocumentId, attr: SchemaAttr, text: &str) -> usize {
|
||||||
|
let mut number_of_words = 0;
|
||||||
let lowercase_text = text.to_lowercase();
|
let lowercase_text = text.to_lowercase();
|
||||||
let deunicoded = deunicode_with_tofu(&lowercase_text, "");
|
let deunicoded = deunicode_with_tofu(&lowercase_text, "");
|
||||||
|
|
||||||
@ -57,8 +58,12 @@ impl RawIndexer {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if !must_continue { break }
|
if !must_continue { break }
|
||||||
|
|
||||||
|
number_of_words += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
number_of_words
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index_text_seq<'a, I, IT>(&mut self, id: DocumentId, attr: SchemaAttr, iter: I)
|
pub fn index_text_seq<'a, I, IT>(&mut self, id: DocumentId, attr: SchemaAttr, iter: I)
|
||||||
|
Loading…
Reference in New Issue
Block a user