Package org.hibernate.search

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


  }

  @Test
  public void testMultipleFiltersOfSameTypeWithDifferentParameters() {
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "fieldConstraintFilter-1" )
        .setParameter( "field", "teacher" )
        .setParameter( "value", "andre" );
    ftQuery.enableFullTextFilter( "fieldConstraintFilter-2" )
        .setParameter( "field", "teacher" )
        .setParameter( "value", "aaron" );
View Full Code Here


  public void testMultipleFiltersOfSameTypeWithDifferentParameters() {
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    ftQuery.enableFullTextFilter( "fieldConstraintFilter-1" )
        .setParameter( "field", "teacher" )
        .setParameter( "value", "andre" );
    ftQuery.enableFullTextFilter( "fieldConstraintFilter-2" )
        .setParameter( "field", "teacher" )
        .setParameter( "value", "aaron" );
    assertEquals( "Should apply both filters resulting in 0 results", 0, ftQuery.getResultSize() );
  }
View Full Code Here

  @Test
  public void testUnknownFilterNameThrowsException() {
    FullTextQuery ftQuery = fullTextSession.createFullTextQuery( query, Driver.class );
    try {
      ftQuery.enableFullTextFilter( "foo" );
      fail( "Retrieving an unknown filter should throw a SearchException" );
    }
    catch (SearchException e) {
      assertEquals( "Wrong message", "HSEARCH000115: Unknown @FullTextFilter: 'foo'", e.getMessage() );
    }
View Full Code Here

    tx = s.beginTransaction();

    QueryParser parser = new QueryParser( TestConstants.getTargetLuceneVersion(), "id", TestConstants.standardAnalyzer );
    org.apache.lucene.search.Query luceneQuery = parser.parse( "street1:Peachtnot" );
    FullTextQuery query = s.createFullTextQuery( luceneQuery ).setProjection( FullTextQuery.THIS, FullTextQuery.SCORE );
    query.enableFullTextFilter( "security" ).setParameter( "ownerName", "test" );
    assertEquals( "expecting 1 results", 1, query.getResultSize() );

    @SuppressWarnings( "unchecked" )
    List<Object[]> results = query.list();
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.