diff --git a/src/docset.rs b/src/docset.rs index 5d6b6f677..c5cb042c6 100644 --- a/src/docset.rs +++ b/src/docset.rs @@ -142,6 +142,11 @@ impl DocSet for Box { 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 DocSet for Box { 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); - } } diff --git a/src/query/union.rs b/src/query/union.rs index f636f0576..94ab7be73 100644 --- a/src/query/union.rs +++ b/src/query/union.rs @@ -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 Scorer for Union