mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-25 20:50:43 +00:00
Fix document generation for posting benchmarks
This commit is contained in:
committed by
Paul Masurel
parent
19c073385a
commit
63867a7150
@@ -415,23 +415,15 @@ mod tests {
|
||||
let mut rng: XorShiftRng = XorShiftRng::from_seed(*seed);
|
||||
|
||||
let index = Index::create_in_ram(schema);
|
||||
let mut count_a = 0;
|
||||
let mut count_b = 0;
|
||||
let posting_list_size = 100_000;
|
||||
let posting_list_size = 1_000_000;
|
||||
{
|
||||
let mut index_writer = index.writer_with_num_threads(1, 40_000_000).unwrap();
|
||||
for _ in 0 .. {
|
||||
if count_a >= posting_list_size &&
|
||||
count_b >= posting_list_size {
|
||||
break;
|
||||
}
|
||||
for _ in 0 .. posting_list_size {
|
||||
let mut doc = Document::default();
|
||||
if count_a < posting_list_size && rng.gen_weighted_bool(15) {
|
||||
count_a += 1;
|
||||
if rng.gen_weighted_bool(15) {
|
||||
doc.add_text(text_field, "a");
|
||||
}
|
||||
if count_b < posting_list_size && rng.gen_weighted_bool(10) {
|
||||
count_b += 1;
|
||||
if rng.gen_weighted_bool(10) {
|
||||
doc.add_text(text_field, "b");
|
||||
}
|
||||
index_writer.add_document(doc);
|
||||
|
||||
Reference in New Issue
Block a user