-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update tantivy to 0.6.1 #28
Conversation
* change from create() to create_in_dir() * fix issue quickwit-oss#12 "Field name must match the pattern"
* remove tantivy::TimerTree code * change Index::open() to Index::open_in_dir() * change Index::create() to Index::create_in_dir()
README.md
Outdated
run `rustup run nightly cargo install tantivy-cli`. (`cargo install tantivy-cli` will work | ||
as well if nightly is your default toolchain). | ||
If you are a Rust programmer, you probably have `cargo` installed and you can just | ||
run `cargo install tantivy-cli` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool you even fixed that
README.md
Outdated
run `rustup run nightly cargo install tantivy-cli`. (`cargo install tantivy-cli` will work | ||
as well if nightly is your default toolchain). | ||
If you are a Rust programmer, you probably have `cargo` installed and you can just | ||
run `cargo install tantivy-cli` | ||
|
||
Alternatively, you can directly download a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this paragraph. I'll readd it if I build binaries.
src/commands/bench.rs
Outdated
@@ -85,6 +82,7 @@ fn run_bench(index_path: &Path, | |||
let mut top_collector = TopCollector::with_limit(10); | |||
query.search(&searcher, &mut top_collector) | |||
.map_err(|e| format!("Failed while retrieving document for query {:?}.\n{:?}", query, e))?; | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the commented block.
Thanks for that. I got a bit sloppy with keeping tantivy-cli up to date. I wrote a few minor comments. Can you address them? |
Thanks for the quick review :) I've made the changes, just wondering if I should remove some of the println!("{}\t{}", "query", "time in microsecs"); |
@nocduro Right! Ideally we want to have The file can be copied from here: https://github.com/tantivy-search/tantivy/blob/0.5.2/src/common/timer.rs And call it manually in the bench. fn run_bench(index_path: &Path,
query_filepath: &Path,
num_repeat: usize) -> Result<(), String> {
println!("index_path : {:?}", index_path);
println!("Query : {:?}", index_path);
println!("-------------------------------\n\n\n");
let index = Index::open(index_path).map_err(|e| format!("Failed to open index.\n{:?}", e))?;
let searcher = index.searcher();
let default_search_fields: Vec<Field> = extract_search_fields(&index.schema());
let queries = read_query_file(query_filepath).map_err(|e| format!("Failed reading the query file: {}", e))?;
let query_parser = QueryParser::new(index.schema(), default_search_fields, index.tokenizers().clone());
println!("SEARCH\n");
println!("{}\t{}\t{}\t{}", "query", "num_terms", "num hits", "time in microsecs");
for _ in 0..num_repeat {
for query_txt in &queries {
let query = query_parser.parse_query(&query_txt).unwrap();
// let num_terms = query.num_terms();
let mut top_collector = TopCollector::with_limit(10);
let mut count_collector = CountCollector::default();
let mut timing = TimerTree::default();
{
let _search = timing.open("search");
let mut collector = chain().push(&mut top_collector).push(&mut count_collector);
query.search(&searcher, &mut collector)
.map_err(|e| format!("Failed while searching query {:?}.\n\n{:?}", query_txt, e))?;
}
println!("{}\t{}\t{}", query_txt, count_collector.count(), timing.total_time());
}
}
println!("\n\nFETCH STORE\n");
println!("{}\t{}", "query", "time in microsecs");
for _ in 0..num_repeat {
for query_txt in &queries {
let query = query_parser.parse_query(&query_txt).unwrap();
let mut top_collector = TopCollector::with_limit(10);
query.search(&searcher, &mut top_collector)
.map_err(|e| format!("Failed while retrieving document for query {:?}.\n{:?}", query, e))?;
let mut timer = TimerTree::default();
{
let _scoped_timer_ = timer.open("total");
for doc_address in top_collector.docs() {
searcher.doc(&doc_address).unwrap();
}
}
println!("{}\t{}", query_txt, timer.total_time());
}
}
Ok(())
} |
Let me know if you can do that. If not just leave it as is, I will merge it and fix that later. |
Sounds good, I'll add it back in |
Awesome ! |
Should be back to how it was now. I tested the web server part and am getting timings at the bottom of the page. |
Awesome. I'll merge once CI has finished its run. |
Thank you @nocduro |
Hi, I couldn't get
cargo install tantivy-cli
to compile, so I went and tried to fix the errors.I ended up updating
tantivy
to 0.6.1Unfortunately I couldn't find the
TimerTree
stuff intantivy
0.6, so I deleted/commented out the timer code for now. I'm not sure what the replacement for that is?cargo update
I tested the basic examples from the readme running the webserver, and fixed a bug in two of the examples caused by the trailing linefeed in the query. This was my first time looking at the
tantivy
code, so I'm not 100% sure if I changed the functions to their correct counterparts in 0.6 (example:Index::open()
toIndex::open_in_dir()
)