use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsBool.
@Test
public void generateOneQueryRuleNotEqualsBool() {
Boolean value = Boolean.TRUE;
Query<Entity> q = new QueryImpl<>().not().eq(boolAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(boolAttrName, value)));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsEmail.
@Test
public void generateOneQueryRuleNotEqualsEmail() {
String value = "e@mail.com";
Query<Entity> q = new QueryImpl<>().not().eq(emailAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(emailAttrName + '.' + FIELD_NOT_ANALYZED, value)));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsBoolNull.
@Test
public void generateOneQueryRuleNotEqualsBoolNull() {
Boolean value = null;
Query<Entity> q = new QueryImpl<>().not().eq(boolAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(boolQuery().mustNot(existsQuery(boolAttrName))));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsXrefNull.
// FIXME add test for ref entity where id attribute is int
// FIXME add test where value is entity
@Test
public void generateOneQueryRuleNotEqualsXrefNull() {
String value = null;
Query<Entity> q = new QueryImpl<>().not().eq(xrefAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(boolQuery().mustNot(nestedQuery(xrefAttrName, existsQuery(xrefAttrName + ".xid"), ScoreMode.Avg))));
assertQueryBuilderEquals(query, expectedQuery);
}
use of org.molgenis.data.support.QueryImpl in project molgenis by molgenis.
the class QueryGeneratorTest method generateOneQueryRuleNotEqualsDate.
@Test
public void generateOneQueryRuleNotEqualsDate() throws ParseException {
LocalDate value = LocalDate.parse("2015-05-22");
Query<Entity> q = new QueryImpl<>().not().eq(dateAttrName, value);
QueryBuilder query = queryGenerator.createQueryBuilder(q, entityType);
QueryBuilder expectedQuery = boolQuery().mustNot(constantScoreQuery(termQuery(dateAttrName, value.toString())));
assertQueryBuilderEquals(query, expectedQuery);
}
Aggregations