diff --git a/master/src/tantivy/query/union.rs.html b/master/src/tantivy/query/union.rs.html index 13dc95f13..363006001 100644 --- a/master/src/tantivy/query/union.rs.html +++ b/master/src/tantivy/query/union.rs.html @@ -472,6 +472,14 @@ 416 417 418 +419 +420 +421 +422 +423 +424 +425 +426
use docset::{DocSet, SkipResult}; use query::Scorer; @@ -584,7 +592,9 @@ } } -impl<TScorer: Scorer, TScoreCombiner: ScoreCombiner> DocSet for Union<TScorer, TScoreCombiner> { +impl<TScorer, TScoreCombiner> DocSet for Union<TScorer, TScoreCombiner> + where TScorer: Scorer, TScoreCombiner: ScoreCombiner +{ fn advance(&mut self) -> bool { if self.advance_buffered() { return true; @@ -727,7 +737,6 @@ use query::score_combiner::DoNothingCombiner; fn aux_test_union(vals: Vec<Vec<u32>>) { - use std::collections::BTreeSet; let mut val_set: BTreeSet<u32> = BTreeSet::new(); for vs in &vals { for &v in vs { @@ -736,17 +745,24 @@ } let union_vals: Vec<u32> = 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::<Vec<ConstScorer<VecDocSet>>>(), - ); + let make_union = || { + Union::from( + vals.iter() + .cloned() + .map(VecDocSet::from) + .map(ConstScorer::new) + .collect::<Vec<ConstScorer<VecDocSet>>>(), + ) + }; + 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] diff --git a/master/tantivy/query/struct.Union.html b/master/tantivy/query/struct.Union.html index a833fabee..c300fe8c8 100644 --- a/master/tantivy/query/struct.Union.html +++ b/master/tantivy/query/struct.Union.html @@ -68,16 +68,16 @@
impl<TScorer, TScoreCombiner> From<Vec<TScorer>> for Union<TScorer, TScoreCombiner> where[src]
TScoreCombiner: ScoreCombiner,
TScorer: Scorer,-
impl<TScorer: Scorer, TScoreCombiner: ScoreCombiner> DocSet for Union<TScorer, TScoreCombiner>[src]+
impl<TScorer, TScoreCombiner> DocSet for Union<TScorer, TScoreCombiner> where[src]
TScorer: Scorer,
TScoreCombiner: ScoreCombiner,
fn advance(&mut self) -> bool[src]Goes to the next element.
-.advance(...)needs to be called a first time to point to the correct element. Read more+
fn count(&mut self) -> u32[src]
fn count(&mut self) -> u32[src]Returns the number documents matching. Read more
-+
fn skip_next(&mut self, target: DocId) -> SkipResult[src]
fn skip_next(&mut self, target: DocId) -> SkipResult[src]After skipping, position the iterator in such a way that
-.doc()will return a value greater than or equal to target. Read more+
fn doc(&self) -> DocId[src]
fn doc(&self) -> DocId[src]Returns the current document
-+
fn size_hint(&self) -> u32[src]
fn size_hint(&self) -> u32[src]Returns a best-effort hint of the length of the docset. Read more
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize[src]Fills a given mutable buffer with the next doc ids from the
@@ -85,8 +85,8 @@DocSetRead moreAdvances the cursor to the next document None is returned if the iterator has
DocSethas already been entirely consumed. Read more
fn append_to_bitset(&mut self, bitset: &mut BitSet)[src]Appends all docs to a
-bitset.-
impl<TScorer, TScoreCombiner> Scorer for Union<TScorer, TScoreCombiner> where[src]
TScoreCombiner: ScoreCombiner,
TScorer: Scorer,+
impl<TScorer, TScoreCombiner> Scorer for Union<TScorer, TScoreCombiner> where[src]
TScoreCombiner: ScoreCombiner,
TScorer: Scorer,
fn score(&mut self) -> Score[src]Returns the score. Read more
fn collect(&mut self, collector: &mut Collector)[src]Consumes the complete
diff --git a/master/tantivy/query/trait.Scorer.html b/master/tantivy/query/trait.Scorer.html index e235380be..c228d3768 100644 --- a/master/tantivy/query/trait.Scorer.html +++ b/master/tantivy/query/trait.Scorer.html @@ -120,7 +120,7 @@ push the scored documents to the collector.DocSetand push the scored documents to the collector. Read moreimpl<TDocSet: DocSet + 'static> Scorer for ConstScorer<TDocSet>impl Scorer for AllScorer- impl<TScorer, TDocSetExclude> Scorer for Exclude<TScorer, TDocSetExclude> where
TScorer: Scorer,
TDocSetExclude: DocSet + 'static,+ impl<TScorer, TScoreCombiner> Scorer for Union<TScorer, TScoreCombiner> where
TScoreCombiner: ScoreCombiner,
TScorer: Scorer,impl<TScorer, TScoreCombiner> Scorer for Union<TScorer, TScoreCombiner> where
TScoreCombiner: ScoreCombiner,
TScorer: Scorer,impl<TScorer> Scorer for Intersection<TScorer> where
TScorer: Scorer,impl<TReqScorer, TOptScorer, TScoreCombiner> Scorer for RequiredOptionalScorer<TReqScorer, TOptScorer, TScoreCombiner> where
TReqScorer: Scorer,
TOptScorer: Scorer,
TScoreCombiner: ScoreCombiner,