[TEST] remove unneeded explain(true)

closes #7248
This commit is contained in:
Britta Weber 2014-08-13 10:00:11 +02:00
parent 9bebccba0c
commit d6312178ad
1 changed files with 23 additions and 32 deletions

View File

@ -102,14 +102,14 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(false).query(constantScoreQuery(termQuery("test", "value")))));
searchSource().query(constantScoreQuery(termQuery("test", "value")))));
SearchResponse sr = response.actionGet();
SearchHits sh = sr.getHits();
assertThat(sh.getTotalHits(), equalTo((long) (numDummyDocs + 2)));
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(constantScoreQuery(termQuery("test", "value")), gaussDecayFunction("loc", lonlat, "1000km")))));
sr = response.actionGet();
sh = sr.getHits();
@ -121,14 +121,14 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(false).query(constantScoreQuery(termQuery("test", "value")))));
searchSource().query(constantScoreQuery(termQuery("test", "value")))));
sr = response.actionGet();
sh = sr.getHits();
assertThat(sh.getTotalHits(), equalTo((long) (numDummyDocs + 2)));
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(constantScoreQuery(termQuery("test", "value")), linearDecayFunction("loc", lonlat, "1000km")))));
sr = response.actionGet();
sh = sr.getHits();
@ -140,14 +140,14 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(false).query(constantScoreQuery(termQuery("test", "value")))));
searchSource().query(constantScoreQuery(termQuery("test", "value")))));
sr = response.actionGet();
sh = sr.getHits();
assertThat(sh.getTotalHits(), equalTo((long) (numDummyDocs + 2)));
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(constantScoreQuery(termQuery("test", "value")), exponentialDecayFunction("loc", lonlat, "1000km")))));
sr = response.actionGet();
sh = sr.getHits();
@ -186,7 +186,6 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource()
.explain(true)
.size(numDummyDocs + 2)
.query(functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 1.0, 5.0).setOffset(1.0))
.boostMode(CombineFunction.REPLACE.getName()))));
@ -205,7 +204,6 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource()
.explain(true)
.size(numDummyDocs + 2)
.query(functionScoreQuery(termQuery("test", "value"),
exponentialDecayFunction("num", 1.0, 5.0).setOffset(1.0)).boostMode(
@ -223,7 +221,6 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource()
.explain(true)
.size(numDummyDocs + 2)
.query(functionScoreQuery(termQuery("test", "value"), linearDecayFunction("num", 1.0, 20.0).setOffset(1.0))
.boostMode(CombineFunction.REPLACE.getName()))));
@ -267,7 +264,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("loc", lonlat, "1000km")).boostMode(
CombineFunction.MULT.getName()))));
SearchResponse sr = response.actionGet();
@ -279,7 +276,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
// Test Exp
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("loc", lonlat, "1000km")).boostMode(
CombineFunction.REPLACE.getName()))));
sr = response.actionGet();
@ -309,7 +306,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
GeoPoint point = new GeoPoint(20, 11);
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("loc", point, "1000km")).boostMode(
CombineFunction.MULT.getName()))));
SearchResponse sr = response.actionGet();
@ -321,7 +318,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("loc", coords, "1000km")).boostMode(
CombineFunction.MULT.getName()))));
sr = response.actionGet();
@ -347,7 +344,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.MULT))));
SearchResponse sr = response.actionGet();
@ -355,11 +352,10 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
assertThat(sh.getTotalHits(), equalTo((long) (1)));
assertThat(sh.getAt(0).getId(), equalTo("1"));
assertThat((double) sh.getAt(0).score(), closeTo(0.30685282, 1.e-5));
logger.info("--> Hit[0] {} Explanation:\n {}", sr.getHits().getAt(0).id(), sr.getHits().getAt(0).explanation());
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.REPLACE))));
sr = response.actionGet();
@ -367,11 +363,10 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
assertThat(sh.getTotalHits(), equalTo((long) (1)));
assertThat(sh.getAt(0).getId(), equalTo("1"));
assertThat((double) sh.getAt(0).score(), closeTo(1.0, 1.e-5));
logger.info("--> Hit[0] {} Explanation:\n {}", sr.getHits().getAt(0).id(), sr.getHits().getAt(0).explanation());
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.SUM))));
sr = response.actionGet();
@ -383,7 +378,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.AVG))));
sr = response.actionGet();
@ -391,11 +386,10 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
assertThat(sh.getTotalHits(), equalTo((long) (1)));
assertThat(sh.getAt(0).getId(), equalTo("1"));
assertThat((double) sh.getAt(0).score(), closeTo((0.30685282 + 0.5), 1.e-5));
logger.info("--> Hit[0] {} Explanation:\n {}", sr.getHits().getAt(0).id(), sr.getHits().getAt(0).explanation());
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.MIN))));
sr = response.actionGet();
@ -403,11 +397,10 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
assertThat(sh.getTotalHits(), equalTo((long) (1)));
assertThat(sh.getAt(0).getId(), equalTo("1"));
assertThat((double) sh.getAt(0).score(), closeTo(2.0 * (0.30685282), 1.e-5));
logger.info("--> Hit[0] {} Explanation:\n {}", sr.getHits().getAt(0).id(), sr.getHits().getAt(0).explanation());
response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num", 0.0, 1.0).setDecay(0.5)).boost(
2.0f).boostMode(CombineFunction.MAX))));
sr = response.actionGet();
@ -415,7 +408,6 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
assertThat(sh.getTotalHits(), equalTo((long) (1)));
assertThat(sh.getAt(0).getId(), equalTo("1"));
assertThat((double) sh.getAt(0).score(), closeTo(1.0, 1.e-5));
logger.info("--> Hit[0] {} Explanation:\n {}", sr.getHits().getAt(0).id(), sr.getHits().getAt(0).explanation());
}
@ -436,7 +428,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num1", "2013-05-28", "-1d")))));
SearchResponse sr = response.actionGet();
@ -461,7 +453,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
SearchResponse sr = client().search(
searchRequest().source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num1", "now", "2d"))))).get();
assertNoFailures(sr);
@ -469,7 +461,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
sr = client().search(
searchRequest().source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value"), gaussDecayFunction("num1", "now-1d", "2d"))))).get();
assertNoFailures(sr);
@ -513,7 +505,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(constantScoreQuery(termQuery("test", "value"))).add(linearDecayFunction("num1", "2013-05-28", "+3d"))
.add(linearDecayFunction("num2", "0.0", "1")).scoreMode("multiply"))));
@ -561,7 +553,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(false).query(
searchSource().query(
functionScoreQuery(QueryBuilders.matchAllQuery()).add(linearDecayFunction("num1", "1000w"))
.add(gaussDecayFunction("num1", "1d")).add(exponentialDecayFunction("num1", "1000w"))
.scoreMode("multiply"))));
@ -650,7 +642,6 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource()
.explain(true)
.size(numDocs)
.query(functionScoreQuery(termQuery("test", "value")).add(new MatchAllFilterBuilder(),
linearDecayFunction("type1.geo", lonlat, "1000km")).scoreMode("multiply"))));
@ -672,7 +663,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
// so, we indexed a string field, but now we try to score a num field
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery(termQuery("test", "value")).add(new MatchAllFilterBuilder(),
linearDecayFunction("num", 1.0, 0.5)).scoreMode("multiply"))));
response.actionGet();
@ -692,7 +683,7 @@ public class DecayFunctionScoreTests extends ElasticsearchIntegrationTest {
// so, we indexed a string field, but now we try to score a num field
ActionFuture<SearchResponse> response = client().search(
searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
searchSource().query(
functionScoreQuery().add(new MatchAllFilterBuilder(), linearDecayFunction("num", 1, 0.5)).scoreMode(
"multiply"))));
response.actionGet();