Skip to content

Commit

Permalink
Remove test
Browse files Browse the repository at this point in the history
  • Loading branch information
mayya-sharipova committed Oct 15, 2020
1 parent 6654c68 commit 7cbe160
Showing 1 changed file with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.elasticsearch.index.analysis.NormalizingCharFilterFactory;
import org.elasticsearch.index.analysis.TokenizerFactory;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.DistanceFeatureQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
import org.elasticsearch.index.query.Operator;
Expand Down Expand Up @@ -1627,33 +1626,6 @@ public void testRangeQueryWithLocaleMapping() throws Exception {
assertHitCount(searchResponse, 2L);
}

public void testDistanceFeatureQuery() {
assertAcked(prepareCreate("test").setMapping("date", "type=date"));
client().prepareIndex("test").setId("1").setSource("date", "2020-12-03T00:00:00Z").get();
client().prepareIndex("test").setId("2").setSource("date", "2020-12-02T00:00:00Z").get();
client().prepareIndex("test").setId("3").setSource("date", "2020-12-01T00:00:00Z").get();
refresh();

DistanceFeatureQueryBuilder dqb = QueryBuilders.distanceFeatureQuery(
"date", new DistanceFeatureQueryBuilder.Origin("2020-12-01T00:00:00Z"), "1d");
SearchResponse searchResponse = client().prepareSearch("test").setQuery(dqb).get();
assertHitCount(searchResponse, 3L);
SearchHit[] hits = searchResponse.getHits().getHits();
assertEquals(1.0f, hits[0].getScore(), 0.1f);
assertEquals(0.5f, hits[1].getScore(), 0.1f);
assertEquals(0.33f, hits[2].getScore(), 0.1f);

DistanceFeatureQueryBuilder dqb2 = QueryBuilders.distanceFeatureQuery(
"date", new DistanceFeatureQueryBuilder.Origin("2020-12-01T00:00:00Z"), "1d");
dqb2.boost(2.0f);
SearchResponse searchResponse2 = client().prepareSearch("test").setQuery(dqb2).get();
assertHitCount(searchResponse2, 3L);
SearchHit[] hits2 = searchResponse2.getHits().getHits();
assertEquals(2.0f, hits2[0].getScore(), 0.1f);
assertEquals(1.0f, hits2[1].getScore(), 0.1f);
assertEquals(0.66f, hits2[2].getScore(),0.1f);
}

public void testSearchEmptyDoc() {
assertAcked(prepareCreate("test").setSettings("{\"index.analysis.analyzer.default.type\":\"keyword\"}", XContentType.JSON));
client().prepareIndex("test").setId("1").setSource("{}", XContentType.JSON).get();
Expand Down

0 comments on commit 7cbe160

Please sign in to comment.