mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-30 15:10:40 +00:00
issue/57 simplified intersection, benchmark on a smaller amount of data.
This commit is contained in:
@@ -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 => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user