Not fetch the cached prefix postings when prefix is disabled

This commit is contained in:
Kerollmops 2020-06-04 21:21:51 +02:00
parent 06bf03f075
commit f55f4cb02a
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -74,15 +74,15 @@ impl Index {
5..=8 => if is_prefix { lev1.build_prefix_dfa(&word) } else if quoted { lev0.build_dfa(&word) } else { lev1.build_dfa(&word) }, 5..=8 => if is_prefix { lev1.build_prefix_dfa(&word) } else if quoted { lev0.build_dfa(&word) } else { lev1.build_dfa(&word) },
_ => if is_prefix { lev2.build_prefix_dfa(&word) } else if quoted { lev0.build_dfa(&word) } else { lev2.build_dfa(&word) }, _ => if is_prefix { lev2.build_prefix_dfa(&word) } else if quoted { lev0.build_dfa(&word) } else { lev2.build_dfa(&word) },
}; };
(word, dfa) (word, is_prefix, dfa)
}); });
let mut intersect_result: Option<RoaringBitmap> = None; let mut intersect_result: Option<RoaringBitmap> = None;
for (word, dfa) in dfas { for (word, is_prefix, dfa) in dfas {
let before = Instant::now(); let before = Instant::now();
let mut union_result = RoaringBitmap::default(); let mut union_result = RoaringBitmap::default();
let count = if word.len() <= 4 { let count = if word.len() <= 4 && is_prefix {
if let Some(ids) = self.prefix_postings_ids.get(rtxn, &word[..word.len().min(5)])? { if let Some(ids) = self.prefix_postings_ids.get(rtxn, &word[..word.len().min(5)])? {
union_result = RoaringBitmap::deserialize_from(ids)?; union_result = RoaringBitmap::deserialize_from(ids)?;
} }