use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsTextNull.
@Test
public void generateOneQueryRuleNotEqualsTextNull() {
String value = null;
Query<Entity> q = new QueryImpl<>().not().eq(textAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(boolQuery().mustNot(existsQuery(textAttrName))));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsInt.
@Test
public void generateOneQueryRuleNotEqualsInt() {
Integer value = 1;
Query<Entity> q = new QueryImpl<>().not().eq(intAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(intAttrName, value)));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsDateTime.
@Test
public void generateOneQueryRuleNotEqualsDateTime() throws ParseException {
Instant value = Instant.parse("2015-05-22T06:12:13Z");
Query<Entity> q = new QueryImpl<>().not().eq(dateTimeAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(dateTimeAttrName, value.toString())));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsHtml.
@Test
public void generateOneQueryRuleNotEqualsHtml() {
String value = "<h1>html</h1>";
Query<Entity> q = new QueryImpl<>().not().eq(htmlAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(htmlAttrName + '.' + FIELD_NOT_ANALYZED, value)));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsHyperlink.
@Test
public void generateOneQueryRuleNotEqualsHyperlink() {
String value = "http://www.website.com/";
Query<Entity> q = new QueryImpl<>().not().eq(hyperlinkAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(hyperlinkAttrName + '.' + FIELD_NOT_ANALYZED, value)));
assertQueryBuilderEquals(query, expectedQuery);
}
Aggregations