Changed the minScore comparator from > to >=

Closes #4303
This commit is contained in:
Clinton Gormley 2013-10-18 14:24:11 +02:00 committed by Luca Cavanna
parent 65541e6912
commit bc393b6d79
3 changed files with 5 additions and 5 deletions

View File

@ -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]
--------------------------------------------------
@ -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.

View File

@ -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;
@ -54,7 +53,7 @@ public class MinimumScoreCollector extends Collector {
@Override
public void collect(int doc) throws IOException {
if (scorer.score() > minimumScore) {
if (scorer.score() >= minimumScore) {
collector.collect(doc);
}
}

View File

@ -1486,7 +1486,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
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));