Skip to content

Commit

Permalink
Changed the minScore comparator from > to >=
Browse files Browse the repository at this point in the history
Closes #4303
  • Loading branch information
clintongormley authored and javanna committed Nov 29, 2013
1 parent 65541e6 commit bc393b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions docs/reference/search/request/min-score.asciidoc
@@ -1,7 +1,8 @@
[[search-request-min-score]]
=== min_score

Allows to filter out documents based on a minimum score:
Exclude documents which have a `_score` less than the minimum specified
in `min_score`:

[source,js]
--------------------------------------------------
Expand All @@ -14,4 +15,4 @@ Allows to filter out documents based on a minimum score:
--------------------------------------------------

Note, most times, this does not make much sense, but is provided for
advance use cases.
advanced use cases.
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.common.lucene;

import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.ScoreCachingWrappingScorer;
import org.apache.lucene.search.Scorer;
Expand Down Expand Up @@ -54,7 +53,7 @@ public void setScorer(Scorer scorer) throws IOException {

@Override
public void collect(int doc) throws IOException {
if (scorer.score() > minimumScore) {
if (scorer.score() >= minimumScore) {
collector.collect(doc);
}
}
Expand Down
Expand Up @@ -1486,7 +1486,7 @@ public void testHasChildQueryWithMinimumScore() throws Exception {
refresh();

SearchResponse searchResponse = client().prepareSearch("test").setQuery(hasChildQuery("child", matchAllQuery()).scoreType("sum"))
.setMinScore(2) // Score needs to be above 2.0!
.setMinScore(3) // Score needs to be 3 or above!
.execute().actionGet();
assertNoFailures(searchResponse);
assertThat(searchResponse.getFailedShards(), equalTo(0));
Expand Down

0 comments on commit bc393b6

Please sign in to comment.