mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-19 01:18:31 +08:00
Perform filter after enumerate to keep origin indices
This commit is contained in:
parent
6a10b679ca
commit
ef13c6a5b6
@ -425,7 +425,13 @@ pub fn resolve_phrase(ctx: &dyn Context, phrase: &[Option<String>]) -> Result<Ro
|
|||||||
for win in phrase.windows(winsize) {
|
for win in phrase.windows(winsize) {
|
||||||
// Get all the documents with the matching distance for each word pairs.
|
// Get all the documents with the matching distance for each word pairs.
|
||||||
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
|
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
|
||||||
for (offset, s1) in win.iter().filter_map(|w| w.as_ref()).enumerate() {
|
for (offset, s1) in win.iter().enumerate().filter_map(|(index, word)| {
|
||||||
|
if let Some(word) = word {
|
||||||
|
Some((index, word))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
for (dist, s2) in win.iter().skip(offset + 1).enumerate().filter_map(|(index, word)| {
|
for (dist, s2) in win.iter().skip(offset + 1).enumerate().filter_map(|(index, word)| {
|
||||||
if let Some(word) = word {
|
if let Some(word) = word {
|
||||||
Some((index, word))
|
Some((index, word))
|
||||||
|
Loading…
Reference in New Issue
Block a user