Sort positions before iterating over them during word pair proximity extraction

This commit is contained in:
many 2021-11-22 18:16:54 +01:00
parent cc32519a2d
commit 8970246bc4
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA

View File

@ -53,7 +53,9 @@ pub fn extract_word_pair_proximity_docids<R: io::Read>(
}
let word = word.to_string();
let mut iter = read_u32_ne_bytes(value).collect::<Vec<_>>().into_iter();
let mut positions: Vec<_> = read_u32_ne_bytes(value).collect();
positions.sort_unstable();
let mut iter = positions.into_iter();
if let Some(position) = iter.next() {
document_word_positions_heap.push(PeekedWordPosition { word, position, iter });
}