mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Fix panic when phrase contains only one stop word and nothing else
This commit is contained in:
parent
bb9ce3c5c5
commit
2aa11afb87
2 changed files with 14 additions and 0 deletions
|
@ -422,6 +422,11 @@ pub fn resolve_phrase(ctx: &dyn Context, phrase: &[Option<String>]) -> Result<Ro
|
|||
let mut candidates = RoaringBitmap::new();
|
||||
let mut first_iter = true;
|
||||
let winsize = phrase.len().min(3);
|
||||
|
||||
if phrase.is_empty() {
|
||||
return Ok(candidates);
|
||||
}
|
||||
|
||||
for win in phrase.windows(winsize) {
|
||||
// Get all the documents with the matching distance for each word pairs.
|
||||
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue