Package org.hibernate.search

Examples of org.hibernate.search.FullTextQuery.enableFullTextFilter()


    catch (IllegalStateException e) {
      fail( "Cache results does not work" );
    }

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "cacheinstancetest" );
    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 1 );
    assertEquals( "Should filter out all", 0, ftQuery.getResultSize() );
    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 2 ); // HSEARCH-818 : would be even better if it was still at 1 here, reusing what was created at SearchFactory build time

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
View Full Code Here


    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 1 );
    assertEquals( "Should filter out all", 0, ftQuery.getResultSize() );
    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 2 ); // HSEARCH-818 : would be even better if it was still at 1 here, reusing what was created at SearchFactory build time

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "cacheinstancetest" );
    ftQuery.getResultSize();
//    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 2 ); //uncomment this when solving HSEARCH-818
  }

  @Test
View Full Code Here

  }

  @Test
  public void testStraightFilters() {
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    Filter dateFilter = TermRangeFilter.newStringRange( "delivery", "2001", "2005", true, true );
    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
View Full Code Here

    Filter dateFilter = TermRangeFilter.newStringRange( "delivery", "2001", "2005", true, true );
    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "empty" );
    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.setFilter( dateFilter );
View Full Code Here

    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "empty" );
    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.setFilter( dateFilter );
    ftQuery.enableFullTextFilter( "bestDriver" );
View Full Code Here

    ftQuery.enableFullTextFilter( "empty" );
    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.setFilter( dateFilter );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    ftQuery.disableFullTextFilter( "security" );
    ftQuery.disableFullTextFilter( "bestDriver" );
    ftQuery.setFilter( null );
    assertEquals( "Should not filter anymore", 3, ftQuery.getResultSize() );
View Full Code Here

    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.setFilter( dateFilter );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    ftQuery.disableFullTextFilter( "security" );
    ftQuery.disableFullTextFilter( "bestDriver" );
    ftQuery.setFilter( null );
    assertEquals( "Should not filter anymore", 3, ftQuery.getResultSize() );
  }
View Full Code Here

  @TestForIssue(jiraKey = "HSEARCH-1513")
  @Test
  public void testCachedEmptyFilters() {
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    Filter dateFilter = TermRangeFilter.newStringRange( "delivery", "2001", "2005", true, true );
    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
View Full Code Here

    Filter dateFilter = TermRangeFilter.newStringRange( "delivery", "2001", "2005", true, true );
    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "cached_empty" );
    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );
  }

  @Test
View Full Code Here

    ftQuery.setFilter( dateFilter );
    assertEquals( "Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "cached_empty" );
    assertEquals( "two filters, one is empty, should not match anything", 0, ftQuery.getResultSize() );
  }

  @Test
  public void testMultipleFiltersOfSameTypeWithDifferentParameters() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.