Added more test assertions
This commit is contained in:
parent
7ea6cd6888
commit
c390f9b1a9
|
@ -679,12 +679,15 @@ public class SimpleQueryTests extends AbstractNodesTests {
|
||||||
.setQuery(multiMatchQuery)
|
.setQuery(multiMatchQuery)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[0].id(), equalTo("1"));
|
||||||
|
|
||||||
multiMatchQuery.minimumShouldMatch("30%");
|
multiMatchQuery.minimumShouldMatch("30%");
|
||||||
searchResponse = client.prepareSearch()
|
searchResponse = client.prepareSearch()
|
||||||
.setQuery(multiMatchQuery)
|
.setQuery(multiMatchQuery)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(2l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(2l));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[0].id(), equalTo("1"));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[1].id(), equalTo("2"));
|
||||||
|
|
||||||
multiMatchQuery.useDisMax(false);
|
multiMatchQuery.useDisMax(false);
|
||||||
multiMatchQuery.minimumShouldMatch("70%");
|
multiMatchQuery.minimumShouldMatch("70%");
|
||||||
|
@ -692,12 +695,15 @@ public class SimpleQueryTests extends AbstractNodesTests {
|
||||||
.setQuery(multiMatchQuery)
|
.setQuery(multiMatchQuery)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[0].id(), equalTo("1"));
|
||||||
|
|
||||||
multiMatchQuery.minimumShouldMatch("30%");
|
multiMatchQuery.minimumShouldMatch("30%");
|
||||||
searchResponse = client.prepareSearch()
|
searchResponse = client.prepareSearch()
|
||||||
.setQuery(multiMatchQuery)
|
.setQuery(multiMatchQuery)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(2l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(2l));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[0].id(), equalTo("1"));
|
||||||
|
assertThat(searchResponse.getHits().getHits()[1].id(), equalTo("2"));
|
||||||
|
|
||||||
multiMatchQuery = multiMatchQuery("value1 value2 bar", "field1");
|
multiMatchQuery = multiMatchQuery("value1 value2 bar", "field1");
|
||||||
multiMatchQuery.minimumShouldMatch("100%");
|
multiMatchQuery.minimumShouldMatch("100%");
|
||||||
|
@ -711,7 +717,8 @@ public class SimpleQueryTests extends AbstractNodesTests {
|
||||||
.setQuery(multiMatchQuery)
|
.setQuery(multiMatchQuery)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||||
}
|
assertThat(searchResponse.getHits().getHits()[0].id(), equalTo("1"));
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testFuzzyQueryString() {
|
public void testFuzzyQueryString() {
|
||||||
client.admin().indices().prepareDelete().execute().actionGet();
|
client.admin().indices().prepareDelete().execute().actionGet();
|
||||||
|
|
Loading…
Reference in New Issue