Explanation as a struct

This commit is contained in:
Paul Masurel
2016-08-06 00:46:50 +09:00
parent 140f6fd2b4
commit bc54db6872
10 changed files with 147 additions and 79 deletions

View File

@@ -9,7 +9,6 @@ use schema::{Term, Field};
use analyzer::SimpleTokenizer;
use analyzer::StreamingIterator;
use DocAddress;
use Score;
use query::Explanation;
#[derive(Debug)]
@@ -50,13 +49,14 @@ impl Query for StandardQuery {
fn explain(
&self,
searcher: &Searcher,
doc_address: &DocAddress) -> Result<Option<(Score, Explanation)>, io::Error> {
doc_address: &DocAddress) -> Result<Explanation, String> {
match self {
&StandardQuery::MultiTerm(ref q) => q.explain(searcher, doc_address)
}
}
}
fn compute_terms(field: Field, text: &str) -> Vec<Term> {
let tokenizer = SimpleTokenizer::new();
let mut tokens = Vec::new();