List of usage examples for org.springframework.data.solr.core.query Criteria getPredicates
public Set<Predicate> getPredicates()
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testBetweenWithoutUpperBound() { Criteria criteria = new Criteria("field_1").between(100, null); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertEquals(100, ((Object[]) entry.getValue())[0]); Assert.assertNull(((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testBetweenWithoutLowerBound() { Criteria criteria = new Criteria("field_1").between(null, 200); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertNull(((Object[]) entry.getValue())[0]); Assert.assertEquals(200, ((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testBetweenExcludingLowerBound() { Criteria criteria = new Criteria("field_1").between(100, 200, false, true); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertEquals(100, ((Object[]) entry.getValue())[0]); Assert.assertEquals(200, ((Object[]) entry.getValue())[1]); Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testBetweenExcludingUpperBound() { Criteria criteria = new Criteria("field_1").between(100, 200, true, false); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertEquals(100, ((Object[]) entry.getValue())[0]); Assert.assertEquals(200, ((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testBetweenWithoutLowerAndUpperBound() { Criteria criteria = new Criteria("field_1").between(null, null); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertNull(((Object[]) entry.getValue())[0]); Assert.assertNull(((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testLessThan() { Criteria criteria = new Criteria("field_1").lessThan(200); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertNull(((Object[]) entry.getValue())[0]); Assert.assertEquals(200, ((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testLessThanEqual() { Criteria criteria = new Criteria("field_1").lessThanEqual(200); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertNull(((Object[]) entry.getValue())[0]); Assert.assertEquals(200, ((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testLessThanEqualNull() { Criteria criteria = new Criteria("field_1").lessThanEqual(null); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertNull(((Object[]) entry.getValue())[0]); Assert.assertNull(((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testGreaterThan() { Criteria criteria = new Criteria("field_1").greaterThan(100); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertEquals(100, ((Object[]) entry.getValue())[0]); Assert.assertNull(((Object[]) entry.getValue())[1]); Assert.assertFalse(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }
From source file:org.springframework.data.solr.core.query.CriteriaTests.java
@Test public void testGreaterThanEqual() { Criteria criteria = new Criteria("field_1").greaterThanEqual(100); Predicate entry = getPredicateByPosition(criteria.getPredicates(), 0); Assert.assertEquals(OperationKey.BETWEEN.getKey(), entry.getKey()); Assert.assertEquals(100, ((Object[]) entry.getValue())[0]); Assert.assertNull(((Object[]) entry.getValue())[1]); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[2]).booleanValue()); Assert.assertTrue(((Boolean) ((Object[]) entry.getValue())[3]).booleanValue()); }