use of com.yelp.nrtsearch.server.grpc.TermQuery in project nrtsearch by Yelp.
the class BooleanFieldTest method testTermQueryUnsetTerm.
@Test(expected = StatusRuntimeException.class)
public void testTermQueryUnsetTerm() {
TermQuery falseQuery = TermQuery.newBuilder().setField("single").build();
queryAndVerifyIds(falseQuery);
}
use of com.yelp.nrtsearch.server.grpc.TermQuery in project nrtsearch by Yelp.
the class BooleanFieldTest method testTermQueryLongTerm.
@Test(expected = StatusRuntimeException.class)
public void testTermQueryLongTerm() {
TermQuery falseQuery = TermQuery.newBuilder().setField("single").setLongValue(0).build();
queryAndVerifyIds(falseQuery);
}
use of com.yelp.nrtsearch.server.grpc.TermQuery in project nrtsearch by Yelp.
the class BooleanFieldTest method testTermQueryMultiOne.
@Test
public void testTermQueryMultiOne() {
TermQuery falseBoolQuery = TermQuery.newBuilder().setField("multi_one").setBooleanValue(false).build();
TermQuery trueBoolQuery = TermQuery.newBuilder().setField("multi_one").setBooleanValue(true).build();
queryAndVerifyIds(trueBoolQuery, "2");
queryAndVerifyIds(falseBoolQuery, "1");
}
use of com.yelp.nrtsearch.server.grpc.TermQuery in project nrtsearch by Yelp.
the class BooleanFieldTest method queryAndVerifyIds.
private void queryAndVerifyIds(TermQuery termQuery, String... expectedIds) {
Query query = Query.newBuilder().setTermQuery(termQuery).build();
SearchResponse response = getGrpcServer().getBlockingStub().search(SearchRequest.newBuilder().setIndexName(DEFAULT_TEST_INDEX).setStartHit(0).setTopHits(10).setQuery(query).addRetrieveFields("doc_id").build());
List<String> idList = Arrays.asList(expectedIds);
assertEquals(idList.size(), response.getHitsCount());
for (Hit hit : response.getHitsList()) {
assertTrue(idList.contains(hit.getFieldsOrThrow("doc_id").getFieldValue(0).getTextValue()));
}
}
use of com.yelp.nrtsearch.server.grpc.TermQuery in project nrtsearch by Yelp.
the class BooleanFieldTest method testTermQueryMultiOneBooleanStrings.
public void testTermQueryMultiOneBooleanStrings() {
TermQuery falseQuery = TermQuery.newBuilder().setField("multi_one").setTextValue("false").build();
TermQuery trueQuery = TermQuery.newBuilder().setField("multi_one").setTextValue("true").build();
queryAndVerifyIds(trueQuery, "2");
queryAndVerifyIds(falseQuery, "1");
}
Aggregations