issue/57 simplified intersection, benchmark on a smaller amount of data.

This commit is contained in:
Paul Masurel
2016-11-12 17:34:42 +09:00
parent a5482952f7
commit 1b6bd80557
3 changed files with 7 additions and 12 deletions

View File

@@ -36,7 +36,9 @@ pub trait DocSet {
/// skipping will advance to the next position and return SkipResult::Overstep.
///
fn skip_next(&mut self, target: DocId) -> SkipResult {
self.advance();
if !self.advance() {
return SkipResult::End;
}
loop {
match self.doc().cmp(&target) {
Ordering::Less => {

View File

@@ -38,16 +38,9 @@ impl<TDocSet: DocSet> DocSet for IntersectionDocSet<TDocSet> {
return false;
}
let num_docsets = self.docsets.len();
let mut count_matching = 1;
let mut doc_candidate = {
let mut first_docset = &mut self.docsets[0];
if !first_docset.advance() {
self.finished = true;
return false;
}
first_docset.doc()
};
let mut ord = 1;
let mut count_matching = 0;
let mut doc_candidate = 0;
let mut ord = 0;
loop {
let mut doc_set = &mut self.docsets[ord];
match doc_set.skip_next(doc_candidate) {

View File

@@ -231,7 +231,7 @@ mod tests {
let index = Index::create_in_ram(schema);
{
let mut index_writer = index.writer_with_num_threads(1, 40_000_000).unwrap();
for _ in 0 .. 15_000_000 {
for _ in 0 .. 1_500_000 {
let mut doc = Document::default();
if rng.gen_weighted_bool(15) {
doc.add_text(text_field, "a");