Skip to content

Commit

Permalink
fix min_should_match for missing-scorers
Browse files Browse the repository at this point in the history
  • Loading branch information
jtong11 committed Nov 23, 2020
1 parent f69322c commit 2ff882b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/search/query/boolean_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ impl<C: Codec> Weight<C> for BooleanWeight<C> {
}
match scorers.len() {
0 => None,
1 => Some(scorers.remove(0)),
// min_should_match
//1 => Some(scorers.remove(0)),
_ => Some(Box::new(DisjunctionSumScorer::new(
scorers,
self.needs_scores,
Expand Down
4 changes: 2 additions & 2 deletions src/core/search/scorer/disjunction_scorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<T: Scorer> DisjunctionSumScorer<T> {
needs_scores: bool,
min_should_match: i32,
) -> DisjunctionSumScorer<T> {
assert!(children.len() > 1);
debug_assert!(children.len() > 0);

let cost = children.iter().map(|w| w.cost()).sum();

Expand Down Expand Up @@ -121,7 +121,7 @@ impl<T: Scorer> DisjunctionMaxScorer<T> {
tie_breaker_multiplier: f32,
needs_scores: bool,
) -> DisjunctionMaxScorer<T> {
assert!(children.len() > 1);
debug_assert!(children.len() > 0);

let cost = children.iter().map(|w| w.cost()).sum();

Expand Down

0 comments on commit 2ff882b

Please sign in to comment.