* Added explanation

* Explain

* Splitting weight and idf

* Added comments

Closes #36
This commit is contained in:
Paul Masurel
2019-06-06 10:03:54 +09:00
committed by GitHub
parent d590f4c6b0
commit 4822940b19
17 changed files with 493 additions and 86 deletions

View File

@@ -1,6 +1,7 @@
use super::Scorer;
use query::Query;
use query::explanation::does_not_match;
use query::Weight;
use query::{Explanation, Query};
use DocId;
use DocSet;
use Result;
@@ -32,6 +33,10 @@ impl Weight for EmptyWeight {
fn scorer(&self, _reader: &SegmentReader) -> Result<Box<Scorer>> {
Ok(Box::new(EmptyScorer))
}
fn explain(&self, _reader: &SegmentReader, doc: DocId) -> Result<Explanation> {
Err(does_not_match(doc))
}
}
/// `EmptyScorer` is a dummy `Scorer` in which no document matches.