mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Fixes #4974
This commit is contained in:
parent
8924d486db
commit
510ca99996
@ -193,15 +193,23 @@ pub fn compute_phrase_docids(
|
|||||||
if words.is_empty() {
|
if words.is_empty() {
|
||||||
return Ok(RoaringBitmap::new());
|
return Ok(RoaringBitmap::new());
|
||||||
}
|
}
|
||||||
let mut candidates = RoaringBitmap::new();
|
let mut candidates = None;
|
||||||
for word in words.iter().flatten().copied() {
|
for word in words.iter().flatten().copied() {
|
||||||
if let Some(word_docids) = ctx.word_docids(None, Word::Original(word))? {
|
if let Some(word_docids) = ctx.word_docids(None, Word::Original(word))? {
|
||||||
candidates |= word_docids;
|
if let Some(candidates) = candidates.as_mut() {
|
||||||
|
*candidates &= word_docids;
|
||||||
|
} else {
|
||||||
|
candidates = Some(word_docids);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return Ok(RoaringBitmap::new());
|
return Ok(RoaringBitmap::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let Some(mut candidates) = candidates else {
|
||||||
|
return Ok(RoaringBitmap::new());
|
||||||
|
};
|
||||||
|
|
||||||
let winsize = words.len().min(3);
|
let winsize = words.len().min(3);
|
||||||
|
|
||||||
for win in words.windows(winsize) {
|
for win in words.windows(winsize) {
|
||||||
|
Loading…
Reference in New Issue
Block a user