Don't remove phrases with "last" term matching strategy

This commit is contained in:
Loïc Lecrenier 2023-04-03 09:17:33 +02:00
parent 12b26cd54e
commit 24e5f6f7a9

View File

@ -891,6 +891,11 @@ pub fn make_ngram(
number_of_typos_allowed: &impl Fn(&str) -> u8, number_of_typos_allowed: &impl Fn(&str) -> u8,
) -> Result<Option<LocatedQueryTerm>> { ) -> Result<Option<LocatedQueryTerm>> {
assert!(!terms.is_empty()); assert!(!terms.is_empty());
for t in terms {
if ctx.term_interner.get(t.value).zero_typo.phrase.is_some() {
return Ok(None);
}
}
for ts in terms.windows(2) { for ts in terms.windows(2) {
let [t1, t2] = ts else { panic!() }; let [t1, t2] = ts else { panic!() };
if *t1.positions.end() != t2.positions.start() - 1 { if *t1.positions.end() != t2.positions.start() - 1 {