Skip to content

Commit

Permalink
Still not working...
Browse files Browse the repository at this point in the history
  • Loading branch information
castagna committed Oct 8, 2010
1 parent 131de9c commit 4d94f8d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/test/java/dev/ESTest1.java
@@ -1,8 +1,9 @@
package dev;

import static org.elasticsearch.index.query.xcontent.QueryBuilders.fieldQuery;

import static org.elasticsearch.client.Requests.refreshRequest;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.xcontent.QueryBuilders.termQuery;

import java.io.IOException;

Expand Down Expand Up @@ -56,7 +57,7 @@ public void test() throws IOException {
refresh(client);
SearchHits hits = search(client, "Hello");
assertEquals(1, hits.totalHits());
assertEquals(FIELD_VALUE, hits.getAt(0).field(FIELD_NAME).getValue().toString());
assertEquals(FIELD_VALUE, hits.getHits()[0].getFields().get(FIELD_NAME).value());
}

private void refresh(Client client) {
Expand All @@ -67,7 +68,7 @@ private void refresh(Client client) {
private SearchHits search(Client client, String query) {
SearchRequestBuilder srb = client.prepareSearch(INDEX_NAME);
srb.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
srb.setQuery(termQuery(FIELD_NAME, query));
srb.setQuery(fieldQuery(FIELD_NAME, query));
srb.setFrom(0);
srb.setSize(10);
srb.setExplain(false);
Expand Down

0 comments on commit 4d94f8d

Please sign in to comment.