mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-29 16:24:26 +01:00
keep phrases that has at least one word
This commit is contained in:
parent
28b7d73d4a
commit
900bae3d9d
@ -825,9 +825,13 @@ where
|
|||||||
quoted = !quoted;
|
quoted = !quoted;
|
||||||
}
|
}
|
||||||
// if there is a quote or a hard separator we close the phrase.
|
// if there is a quote or a hard separator we close the phrase.
|
||||||
if !phrase.is_empty() && (quote_count > 0 || separator_kind == SeparatorKind::Hard)
|
if quote_count > 0 || separator_kind == SeparatorKind::Hard {
|
||||||
{
|
let phrase = mem::take(&mut phrase);
|
||||||
primitive_query.push(PrimitiveQueryPart::Phrase(mem::take(&mut phrase)));
|
|
||||||
|
// if the phrase only contains stop words, we don't keep it in the query.
|
||||||
|
if phrase.iter().any(|w| w.is_some()) {
|
||||||
|
primitive_query.push(PrimitiveQueryPart::Phrase(phrase));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
@ -835,7 +839,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a quote is never closed, we consider all of the end of the query as a phrase.
|
// If a quote is never closed, we consider all of the end of the query as a phrase.
|
||||||
if !phrase.is_empty() {
|
if phrase.iter().any(|w| w.is_some()) {
|
||||||
primitive_query.push(PrimitiveQueryPart::Phrase(mem::take(&mut phrase)));
|
primitive_query.push(PrimitiveQueryPart::Phrase(mem::take(&mut phrase)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user