mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-30 23:20:40 +00:00
Added impl for for_each specific to unions.
This commit is contained in:
@@ -142,6 +142,11 @@ impl<TDocSet: DocSet + ?Sized> DocSet for Box<TDocSet> {
|
||||
unboxed.size_hint()
|
||||
}
|
||||
|
||||
fn append_to_bitset(&mut self, bitset: &mut BitSet) {
|
||||
let unboxed: &mut TDocSet = self.borrow_mut();
|
||||
unboxed.append_to_bitset(bitset);
|
||||
}
|
||||
|
||||
fn count(&mut self, delete_bitset: &DeleteBitSet) -> u32 {
|
||||
let unboxed: &mut TDocSet = self.borrow_mut();
|
||||
unboxed.count(delete_bitset)
|
||||
@@ -151,9 +156,4 @@ impl<TDocSet: DocSet + ?Sized> DocSet for Box<TDocSet> {
|
||||
let unboxed: &mut TDocSet = self.borrow_mut();
|
||||
unboxed.count_including_deleted()
|
||||
}
|
||||
|
||||
fn append_to_bitset(&mut self, bitset: &mut BitSet) {
|
||||
let unboxed: &mut TDocSet = self.borrow_mut();
|
||||
unboxed.append_to_bitset(bitset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +250,22 @@ where
|
||||
fn size_hint(&self) -> u32 {
|
||||
0u32
|
||||
}
|
||||
|
||||
fn for_each(&mut self, callback: &mut FnMut(DocId, Score)) {
|
||||
// TODO how do we deal with the fact that people may have called .advance() before.
|
||||
while self.refill() {
|
||||
let offset = self.offset;
|
||||
for cursor in 0..HORIZON_NUM_TINYBITSETS {
|
||||
while let Some(val) = self.bitsets[cursor].pop_lowest() {
|
||||
let delta = val + (cursor as u32) * 64;
|
||||
let doc = offset + delta;
|
||||
let score_combiner = &mut self.scores[delta as usize];
|
||||
let score = score_combiner.score();
|
||||
score_combiner.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<TScorer, TScoreCombiner> Scorer for Union<TScorer, TScoreCombiner>
|
||||
|
||||
Reference in New Issue
Block a user