From 830a7c0c7ab8a39f3444d767d802fdac86ea2c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 15 Sep 2022 13:34:52 +0200 Subject: [PATCH] Use `resolve_phrase` function for exactness criteria as well --- milli/src/search/criteria/exactness.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/milli/src/search/criteria/exactness.rs b/milli/src/search/criteria/exactness.rs index 5327f13e4..d5b2ff0ee 100644 --- a/milli/src/search/criteria/exactness.rs +++ b/milli/src/search/criteria/exactness.rs @@ -7,7 +7,7 @@ use log::debug; use roaring::RoaringBitmap; use crate::search::criteria::{ - resolve_query_tree, Context, Criterion, CriterionParameters, CriterionResult, + resolve_phrase, resolve_query_tree, Context, Criterion, CriterionParameters, CriterionResult, }; use crate::search::query_tree::{Operation, PrimitiveQueryPart}; use crate::{absolute_from_relative_position, FieldId, Result}; @@ -226,20 +226,7 @@ fn resolve_state( } // compute intersection on pair of words with a proximity of 0. Phrase(phrase) => { - // TODO: use resolve_phrase here - let mut bitmaps = Vec::with_capacity(phrase.len().saturating_sub(1)); - for words in phrase.windows(2) { - if let [left, right] = words { - match ctx.word_pair_proximity_docids(left, right, 0)? { - Some(docids) => bitmaps.push(docids), - None => { - bitmaps.clear(); - break; - } - } - } - } - candidates |= intersection_of(bitmaps.iter().collect()); + candidates |= resolve_phrase(ctx, phrase)?; } } parts_candidates_array.push(candidates);