mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 16:51:01 +00:00
Add a little bit more debug
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@ -79,18 +79,21 @@ impl Index {
|
||||
|
||||
let mut union_result = RoaringBitmap::default();
|
||||
if word.len() <= 4 {
|
||||
if let Some(ids) = self.prefix_postings_ids.get(rtxn, &word[..word.len().min(4)])? {
|
||||
if let Some(ids) = self.prefix_postings_ids.get(rtxn, &word[..word.len().min(5)])? {
|
||||
union_result = RoaringBitmap::deserialize_from(ids)?;
|
||||
}
|
||||
} else {
|
||||
let mut count = 0;
|
||||
let mut stream = fst.search(dfa).into_stream();
|
||||
while let Some(word) = stream.next() {
|
||||
count += 1;
|
||||
let word = std::str::from_utf8(word)?;
|
||||
if let Some(ids) = self.postings_ids.get(rtxn, word)? {
|
||||
let right = RoaringBitmap::deserialize_from(ids)?;
|
||||
union_result.union_with(&right);
|
||||
}
|
||||
}
|
||||
eprint!("with {:?} words ", count);
|
||||
}
|
||||
eprintln!("union for {:?} took {:.02?}", word, before.elapsed());
|
||||
|
||||
@ -99,14 +102,16 @@ impl Index {
|
||||
let before = Instant::now();
|
||||
let left_len = left.len();
|
||||
left.intersect_with(&union_result);
|
||||
eprintln!("intersect between {:?} and {:?} took {:.02?}",
|
||||
left_len, union_result.len(), before.elapsed());
|
||||
eprintln!("intersect between {:?} and {:?} gives {:?} took {:.02?}",
|
||||
left_len, union_result.len(), left.len(), before.elapsed());
|
||||
Some(left)
|
||||
},
|
||||
None => Some(union_result),
|
||||
};
|
||||
}
|
||||
|
||||
eprintln!("{} candidates", intersect_result.as_ref().map_or(0, |r| r.len()));
|
||||
|
||||
Ok(intersect_result.unwrap_or_default().iter().take(20).collect())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user