optimize word prefix pair

This commit is contained in:
ad hoc 2022-03-15 16:37:22 +01:00
parent d68fe2b3c7
commit d633ac5b9d
No known key found for this signature in database
GPG Key ID: 4F00A782990CC643

View File

@ -155,20 +155,20 @@ impl<'t, 'u, 'i> WordPrefixPairProximityDocids<'t, 'u, 'i> {
// All of the word prefix pairs in the database that have a w2 // All of the word prefix pairs in the database that have a w2
// that is contained in the `suppr_pw` set must be removed as well. // that is contained in the `suppr_pw` set must be removed as well.
let mut iter = self if !del_prefix_fst_words.is_empty() {
.index let mut iter = self
.word_prefix_pair_proximity_docids .index
.remap_data_type::<ByteSlice>() .word_prefix_pair_proximity_docids
.iter_mut(self.wtxn)?; .remap_data_type::<ByteSlice>()
while let Some(((_, w2, _), _)) = iter.next().transpose()? { .iter_mut(self.wtxn)?;
if del_prefix_fst_words.contains(w2.as_bytes()) { while let Some(((_, w2, _), _)) = iter.next().transpose()? {
// Delete this entry as the w2 prefix is no more in the words prefix fst. if del_prefix_fst_words.contains(w2.as_bytes()) {
unsafe { iter.del_current()? }; // Delete this entry as the w2 prefix is no more in the words prefix fst.
unsafe { iter.del_current()? };
}
} }
} }
drop(iter);
// We finally write and merge the new word prefix pair proximity docids // We finally write and merge the new word prefix pair proximity docids
// in the LMDB database. // in the LMDB database.
sorter_into_lmdb_database( sorter_into_lmdb_database(