mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Change closure to fn
This commit is contained in:
parent
51085206cc
commit
993408d3ba
@ -388,14 +388,18 @@ impl<'t, 'tokenizer> Matcher<'t, 'tokenizer, '_, '_> {
|
|||||||
let mut distance_score = 0;
|
let mut distance_score = 0;
|
||||||
|
|
||||||
// count score for phrases
|
// count score for phrases
|
||||||
let tally_phrase_scores =
|
fn tally_phrase_scores(
|
||||||
|fwp: &usize, lwp: &usize, order_score: &mut i16, distance_score: &mut i16| {
|
fwp: &usize,
|
||||||
let words_in_phrase_minus_one = (lwp - fwp) as i16;
|
lwp: &usize,
|
||||||
// will always be ordered, so +1 for each space between words
|
order_score: &mut i16,
|
||||||
*order_score += words_in_phrase_minus_one;
|
distance_score: &mut i16,
|
||||||
// distance will always be 1, so -1 for each space between words
|
) {
|
||||||
*distance_score -= words_in_phrase_minus_one;
|
let words_in_phrase_minus_one = (lwp - fwp) as i16;
|
||||||
};
|
// will always be ordered, so +1 for each space between words
|
||||||
|
*order_score += words_in_phrase_minus_one;
|
||||||
|
// distance will always be 1, so -1 for each space between words
|
||||||
|
*distance_score -= words_in_phrase_minus_one;
|
||||||
|
}
|
||||||
|
|
||||||
let mut iter = matches.iter().peekable();
|
let mut iter = matches.iter().peekable();
|
||||||
while let Some(m) = iter.next() {
|
while let Some(m) = iter.next() {
|
||||||
|
Loading…
Reference in New Issue
Block a user