mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-23 02:29:57 +00:00
Fix explanation of boost queries seeking beyond query result. (#2142)
* Make current nightly Clippy happy. * Fix explanation of boost queries seeking beyond query result.
This commit is contained in:
@@ -221,5 +221,19 @@ fn main() -> tantivy::Result<()> {
|
||||
println!("{}", schema.to_json(&retrieved_doc));
|
||||
}
|
||||
|
||||
// We can also get an explanation to understand
|
||||
// how a found document got its score.
|
||||
let query = query_parser.parse_query("title:sea^20 body:whale^70")?;
|
||||
|
||||
let (_score, doc_address) = searcher
|
||||
.search(&query, &TopDocs::with_limit(1))?
|
||||
.into_iter()
|
||||
.next()
|
||||
.unwrap();
|
||||
|
||||
let explanation = query.explain(&searcher, doc_address)?;
|
||||
|
||||
println!("{}", explanation.to_pretty_json());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user