diff options
author | Laurentiu Nicola <lnicola@dend.ro> | 2017-05-30 15:41:11 +0300 |
---|---|---|
committer | Paul Masurel <paul.masurel@gmail.com> | 2017-05-31 08:31:33 +0900 |
commit | a94679d74d6847f827af4932b540038cf7956f6c (patch) | |
tree | 89306137201a3a876f303e8e2443c457e76f014a /src/postings/mod.rs | |
parent | a35a8638cc5ca39ebec7f988499d814004dc3ebe (diff) |
Use four terms in the intersection bench
Diffstat (limited to 'src/postings/mod.rs')
-rw-r--r-- | src/postings/mod.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/postings/mod.rs b/src/postings/mod.rs index fef99d8..5de1f7a 100644 --- a/src/postings/mod.rs +++ b/src/postings/mod.rs @@ -383,6 +383,14 @@ mod tests { let field = Field(0); Term::from_field_text(field, "b") }; + static ref TERM_C: Term = { + let field = Field(0); + Term::from_field_text(field, "c") + }; + static ref TERM_D: Term = { + let field = Field(0); + Term::from_field_text(field, "d") + }; static ref INDEX: Index = { let mut schema_builder = SchemaBuilder::default(); let text_field = schema_builder.add_text_field("text", STRING); @@ -403,6 +411,12 @@ mod tests { if rng.gen_weighted_bool(10) { doc.add_text(text_field, "b"); } + if rng.gen_weighted_bool(5) { + doc.add_text(text_field, "c"); + } + if rng.gen_weighted_bool(1) { + doc.add_text(text_field, "d"); + } index_writer.add_document(doc); } assert!(index_writer.commit().is_ok()); @@ -436,8 +450,16 @@ mod tests { let segment_postings_b = segment_reader .read_postings(&*TERM_B, SegmentPostingsOption::NoFreq) .unwrap(); + let segment_postings_c = segment_reader + .read_postings(&*TERM_C, SegmentPostingsOption::NoFreq) + .unwrap(); + let segment_postings_d = segment_reader + .read_postings(&*TERM_D, SegmentPostingsOption::NoFreq) + .unwrap(); let mut intersection = IntersectionDocSet::from(vec![segment_postings_a, - segment_postings_b]); + segment_postings_b, + segment_postings_c, + segment_postings_d]); while intersection.advance() {} }); } |