mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Consecutive is false when at least 1 stop word is surrounded by words
This commit is contained in:
parent
f1da623af3
commit
af33d22f25
@ -478,14 +478,29 @@ fn resolve_plane_sweep_candidates(
|
|||||||
}
|
}
|
||||||
Phrase(words) => {
|
Phrase(words) => {
|
||||||
let mut groups_positions = Vec::with_capacity(words.len());
|
let mut groups_positions = Vec::with_capacity(words.len());
|
||||||
for word in words.iter().filter_map(|w| w.as_ref()) {
|
let mut consecutive = true;
|
||||||
|
let mut was_last_word_a_stop_word = false;
|
||||||
|
for word in words.iter() {
|
||||||
|
if let Some(word) = word {
|
||||||
let positions = match words_positions.get(word) {
|
let positions = match words_positions.get(word) {
|
||||||
Some(positions) => positions.iter().map(|p| (p, 0, p)).collect(),
|
Some(positions) => positions.iter().map(|p| (p, 0, p)).collect(),
|
||||||
None => return Ok(vec![]),
|
None => return Ok(vec![]),
|
||||||
};
|
};
|
||||||
groups_positions.push(positions);
|
groups_positions.push(positions);
|
||||||
|
|
||||||
|
if was_last_word_a_stop_word {
|
||||||
|
consecutive = false;
|
||||||
}
|
}
|
||||||
plane_sweep(groups_positions, true)?
|
was_last_word_a_stop_word = false;
|
||||||
|
} else {
|
||||||
|
if !was_last_word_a_stop_word {
|
||||||
|
consecutive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
was_last_word_a_stop_word = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plane_sweep(groups_positions, consecutive)?
|
||||||
}
|
}
|
||||||
Or(_, ops) => {
|
Or(_, ops) => {
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user