}
@Test
public void testRangeQueryAbove() throws Exception {
Transaction transaction = fullTextSession.beginTransaction();
final QueryBuilder monthQb = fullTextSession.getSearchFactory()
.buildQueryBuilder().forEntity( Month.class ).get();
calendar.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
calendar.set( 10 + 1900, 2, 12, 0, 0, 0 );
Date to = calendar.getTime();
Query query = monthQb
.range()
.onField( "estimatedCreation" )
.andField( "justfortest" )
.ignoreFieldBridge().ignoreAnalyzer()
.above( to )
.createQuery();
FullTextQuery hibQuery = fullTextSession.createFullTextQuery( query, Month.class );
assertEquals( 1, hibQuery.getResultSize() );
assertEquals( "February", ( (Month) hibQuery.list().get( 0 ) ).getName() );
query = monthQb
.range()
.onField( "estimatedCreation" )
.ignoreFieldBridge()
.andField( "justfortest" )
.ignoreFieldBridge().ignoreAnalyzer()
.above( DateTools.dateToString( to, DateTools.Resolution.MINUTE ) )
.createQuery();
hibQuery = fullTextSession.createFullTextQuery( query, Month.class );
assertEquals( 1, hibQuery.getResultSize() );
assertEquals( "February", ( (Month) hibQuery.list().get( 0 ) ).getName() );
// test the limits, inclusive
query = monthQb
.range()
.onField( "estimatedCreation" )
.andField( "justfortest" )
.ignoreFieldBridge().ignoreAnalyzer()
.above( february )
.createQuery();
hibQuery = fullTextSession.createFullTextQuery( query, Month.class );
assertEquals( 1, hibQuery.getResultSize() );
assertEquals( "February", ( (Month) hibQuery.list().get( 0 ) ).getName() );
// test the limits, exclusive
query = monthQb
.range()
.onField( "estimatedCreation" )
.andField( "justfortest" )
.ignoreFieldBridge().ignoreAnalyzer()
.above( february ).excludeLimit()