Package org.hibernate.search.query.dsl.impl

Examples of org.hibernate.search.query.dsl.impl.ConnectedTermMatchingContext


  public void testUseOfCustomFieldBridgeInstance() throws Exception {
    Transaction transaction = fullTextSession.beginTransaction();
    final QueryBuilder monthQb = fullTextSession.getSearchFactory()
        .buildQueryBuilder().forEntity( Month.class ).get();

    ConnectedTermMatchingContext termMatchingContext = (ConnectedTermMatchingContext) monthQb
        .keyword()
        .onField( MonthClassBridge.FIELD_NAME_1 );

    Query query = termMatchingContext
        .withFieldBridge( new String2FieldBridgeAdaptor( new RomanNumberFieldBridge() ) )
        .matching( 2 )
        .createQuery();

    assertEquals( 1, fullTextSession.createFullTextQuery( query, Month.class ).getResultSize() );
View Full Code Here


    Transaction transaction = fullTextSession.beginTransaction();
    final QueryBuilder monthQb = fullTextSession.getSearchFactory()
        .buildQueryBuilder().forEntity( Month.class ).get();

    //Rather complex code here as we're not exposing the #withFieldBridge methods on the public interface
    final ConnectedTermMatchingContext field1Context = (ConnectedTermMatchingContext) monthQb
        .keyword()
        .onField( MonthClassBridge.FIELD_NAME_1 );

    final ConnectedTermMatchingContext field2Context = (ConnectedTermMatchingContext) field1Context
          .withFieldBridge( new String2FieldBridgeAdaptor( new RomanNumberFieldBridge() ) )
        .andField( MonthClassBridge.FIELD_NAME_2 );

    Query query = field2Context
          .withFieldBridge( new String2FieldBridgeAdaptor( new RomanNumberFieldBridge() ) )
          .matching( 2 )
        .createQuery();

    assertEquals( 1, fullTextSession.createFullTextQuery( query, Month.class ).getResultSize() );
View Full Code Here

TOP

Related Classes of org.hibernate.search.query.dsl.impl.ConnectedTermMatchingContext

Copyright © 2018 www.massapicom. 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.