Backmerging master

This commit is contained in:
Paul Masurel
2018-02-12 11:08:57 +09:00
67 changed files with 2060 additions and 1249 deletions

View File

@@ -39,6 +39,13 @@ impl Query for BooleanQuery {
self
}
fn disable_scoring(&mut self) {
self.scoring_disabled = true;
for &mut (_, ref mut subquery) in &mut self.subqueries {
subquery.disable_scoring();
}
}
fn weight(&self, searcher: &Searcher) -> Result<Box<Weight>> {
let sub_weights = self.subqueries
.iter()
@@ -48,13 +55,6 @@ impl Query for BooleanQuery {
.collect::<Result<_>>()?;
Ok(box BooleanWeight::new(sub_weights, self.scoring_disabled))
}
fn disable_scoring(&mut self) {
self.scoring_disabled = true;
for &mut (_, ref mut subquery) in &mut self.subqueries {
subquery.disable_scoring();
}
}
}
impl BooleanQuery {

View File

@@ -24,13 +24,14 @@ impl BooleanWeight {
}
}
impl Weight for BooleanWeight {
fn scorer<'a>(&'a self, reader: &'a SegmentReader) -> Result<Box<Scorer + 'a>> {
if self.weights.is_empty() {
Ok(box EmptyScorer)
} else if self.weights.len() == 1 {
let &(occur, ref weight) = &self.weights[0];
if occur == Occur::MustNot {
let &(occur, ref weight) = &self.weights[0];
if occur == Occur::MustNot {
Ok(box EmptyScorer)
} else {
weight.scorer(reader)