Package org.hibernate.search

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


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

    ftQuery = s.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("Should select only liz", 1, ftQuery.getResultSize() );

    ftQuery = s.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

    FullTextQuery fullTextQuery = fts.createFullTextQuery( parser.parse( "body:message" ) );
    List results = fullTextQuery.list();
    assertEquals( "Query with no filter should bring back results from both shards.", 2, results.size() );

    // index is not a field on the entity; the only way to filter on this is by shard
    fullTextQuery.enableFullTextFilter( "shard" ).setParameter( "index", 0 );
    assertEquals( "Query with filter should bring back results from only one shard.", 1, fullTextQuery.list().size() );

    for ( Object o : results ) {
      s.delete( o );
    }
View Full Code Here

    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    assertEquals( "No filter should happen", 3, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.disableFullTextFilter( "bestDriver" ); //was not enabled, but should be harmless
    ftQuery.enableFullTextFilter( "bestDriver" );
    assertEquals( "Should filter out Gavin", 2, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
View Full Code Here

    ftQuery.disableFullTextFilter( "bestDriver" ); //was not enabled, but should be harmless
    ftQuery.enableFullTextFilter( "bestDriver" );
    assertEquals( "Should filter out Gavin", 2, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    assertEquals( "Should filter to limit to Emmanuel", 1, ftQuery.getResultSize() );

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

    ftQuery.enableFullTextFilter( "bestDriver" );
    assertEquals( "Should filter out Gavin", 2, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    assertEquals( "Should filter to limit to Emmanuel", 1, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
View Full Code Here

    ftQuery.enableFullTextFilter( "bestDriver" );
    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    assertEquals( "Should filter to limit to Emmanuel", 1, ftQuery.getResultSize() );

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

    ftQuery.enableFullTextFilter( "security" ).setParameter( "login", "andre" );
    assertEquals( "Should filter to limit to Emmanuel", 1, ftQuery.getResultSize() );

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

    InstanceBasedExcludeAllFilter.assertConstructorInvoked( 1 ); // SearchFactory tests filter construction once
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    assertEquals( "No filter should happen", 3, ftQuery.getResultSize() );

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "cacheresultstest" );
    assertEquals( "Should filter out all", 0, ftQuery.getResultSize() );

    // HSEARCH-174 - we call System.gc() to force a garbage collection.
    // Prior to the fix for HSEARCH-174 this would cause the filter to be
    // garbage collected since Lucene used weak references.
View Full Code Here

    // Prior to the fix for HSEARCH-174 this would cause the filter to be
    // garbage collected since Lucene used weak references.
    System.gc();

    ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "cacheresultstest" );
    try {
      ftQuery.getResultSize();
    }
    catch (IllegalStateException e) {
      fail( "Cache results does not work" );
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.