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