Make the RawIndexer index_text method return the number of words

This commit is contained in:
Clément Renault 2019-10-14 13:56:52 +02:00
parent b7ea812dcc
commit 9cdda8c46a
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
1 changed files with 6 additions and 1 deletions

View File

@ -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 deunicoded = deunicode_with_tofu(&lowercase_text, "");
@ -57,8 +58,12 @@ impl RawIndexer {
);
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)