Search for closest non-stop words in proximity criteria

This commit is contained in:
Samyak S Sarnayak 2022-10-13 22:47:41 +05:30
parent 709ab3c14c
commit 3e190503e6
No known key found for this signature in database
GPG Key ID: 365873F2F0C6153B

View File

@ -187,14 +187,15 @@ fn resolve_candidates<'t>(
Phrase(words) => {
if proximity == 0 {
let most_left = words
.first()
.map(|o| o.as_ref())
.flatten()
.iter()
.filter_map(|o| o.as_ref())
.next()
.map(|w| Query { prefix: false, kind: QueryKind::exact(w.clone()) });
let most_right = words
.last()
.map(|o| o.as_ref())
.flatten()
.iter()
.rev()
.filter_map(|o| o.as_ref())
.next()
.map(|w| Query { prefix: false, kind: QueryKind::exact(w.clone()) });
match (most_left, most_right) {