diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f425cbc2..3c8bdc34a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ Tantivy 0.5 - Faceting - RangeQuery - Configurable tokenization pipeline -- Allowing super large indexes +- Bugfix in PhraseQuery +- Various query optimisation +- Allowing very large indexes - 64 bits file address - Smarter encoding of the `TermInfo` objects diff --git a/src/query/union.rs b/src/query/union.rs index 40840facc..88df78b2e 100644 --- a/src/query/union.rs +++ b/src/query/union.rs @@ -109,7 +109,9 @@ impl Union DocSet for Union { +impl DocSet for Union + where TScorer: Scorer, TScoreCombiner: ScoreCombiner +{ fn advance(&mut self) -> bool { if self.advance_buffered() { return true; @@ -252,7 +254,6 @@ mod tests { use query::score_combiner::DoNothingCombiner; fn aux_test_union(vals: Vec>) { - use std::collections::BTreeSet; let mut val_set: BTreeSet = BTreeSet::new(); for vs in &vals { for &v in vs { @@ -261,17 +262,24 @@ mod tests { } let union_vals: Vec = val_set.into_iter().collect(); let mut union_expected = VecDocSet::from(union_vals); - let mut union: Union<_, DoNothingCombiner> = Union::from( - vals.into_iter() - .map(VecDocSet::from) - .map(ConstScorer::new) - .collect::>>(), - ); + let make_union = || { + Union::from( + vals.iter() + .cloned() + .map(VecDocSet::from) + .map(ConstScorer::new) + .collect::>>(), + ) + }; + let mut union: Union<_, DoNothingCombiner> = make_union(); + let mut count = 0; while union.advance() { assert!(union_expected.advance()); assert_eq!(union_expected.doc(), union.doc()); + count += 1; } assert!(!union_expected.advance()); + assert_eq!(count, make_union().count()); } #[test]