parent
65541e6912
commit
bc393b6d79
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue