mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
[TEST] Simplify SearchQueryIT#testMinScore
This test used indexRandom to index 4 documents. indexRandom introduces also bogus documents which were getting on the way now that we use fieldValueFactor instead of a script to determine the script of the documents. Taken out indexRandom to simplify things and make the tests more predictable.
This commit is contained in:
parent
2fd1cde35e
commit
d618a602ab
@ -1933,14 +1933,14 @@ public class SearchQueryIT extends ESIntegTestCase {
|
||||
public void testMinScore() throws ExecutionException, InterruptedException {
|
||||
createIndex("test");
|
||||
|
||||
indexRandom(true,
|
||||
client().prepareIndex("test", "test", "1").setSource("score", 1.5),
|
||||
client().prepareIndex("test", "test", "2").setSource("score", 1.0),
|
||||
client().prepareIndex("test", "test", "3").setSource("score", 2.0),
|
||||
client().prepareIndex("test", "test", "4").setSource("score", 0.5));
|
||||
client().prepareIndex("test", "test", "1").setSource("score", 1.5).get();
|
||||
client().prepareIndex("test", "test", "2").setSource("score", 1.0).get();
|
||||
client().prepareIndex("test", "test", "3").setSource("score", 2.0).get();
|
||||
client().prepareIndex("test", "test", "4").setSource("score", 0.5).get();
|
||||
refresh();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("test").setQuery(
|
||||
functionScoreQuery(ScoreFunctionBuilders.fieldValueFactorFunction("score")).setMinScore(1.5f)).get();
|
||||
functionScoreQuery(ScoreFunctionBuilders.fieldValueFactorFunction("score").missing(1.0)).setMinScore(1.5f)).get();
|
||||
assertHitCount(searchResponse, 2);
|
||||
assertFirstHit(searchResponse, hasId("3"));
|
||||
assertSecondHit(searchResponse, hasId("1"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user