|
@@ -8,7 +8,6 @@ use tantivy::query::QueryParser; |
|
|
use tantivy::schema::Field; |
|
|
use tantivy::schema::Field; |
|
|
use serde_json; |
|
|
use serde_json; |
|
|
use tantivy::schema::FieldType; |
|
|
use tantivy::schema::FieldType; |
|
|
use tantivy::tokenizer::*; |
|
|
|
|
|
|
|
|
|
|
|
pub fn run_search_cli(matches: &ArgMatches) -> Result<(), String> { |
|
|
pub fn run_search_cli(matches: &ArgMatches) -> Result<(), String> { |
|
|
let index_directory = PathBuf::from(matches.value_of("index").unwrap()); |
|
|
let index_directory = PathBuf::from(matches.value_of("index").unwrap()); |
|
@@ -39,7 +38,7 @@ fn run_search(directory: &Path, query: &str) -> tantivy::Result<()> { |
|
|
let query_parser = QueryParser::new(schema.clone(), default_fields, index.tokenizers().clone()); |
|
|
let query_parser = QueryParser::new(schema.clone(), default_fields, index.tokenizers().clone()); |
|
|
let query = query_parser.parse_query(query)?; |
|
|
let query = query_parser.parse_query(query)?; |
|
|
let searcher = index.searcher(); |
|
|
let searcher = index.searcher(); |
|
|
let weight = query.weight(&searcher)?; |
|
|
|
|
|
|
|
|
let weight = query.weight(&searcher, false)?; |
|
|
let schema = index.schema(); |
|
|
let schema = index.schema(); |
|
|
for segment_reader in searcher.segment_readers() { |
|
|
for segment_reader in searcher.segment_readers() { |
|
|
let mut scorer = weight.scorer(segment_reader)?; |
|
|
let mut scorer = weight.scorer(segment_reader)?; |
|
|