Examples of moreLikeThis()


Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

  public void testMoreLikeThisBasicBehavior() {
    Transaction transaction = fullTextSession.beginTransaction();
    try {
      QueryBuilder qb = getCoffeeQueryBuilder();
      Coffee decaffInstance = getDecaffInstance( qb );
      Query mltQuery = qb
          .moreLikeThis()
          .favorSignificantTermsWithFactor( 1 )
          .comparingAllFields()
          .toEntityWithId( decaffInstance.getId() )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

              }
          );
      outputQueryAndResults( decaffInstance, mltQuery, results );

      //custom fields
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntityWithId( decaffInstance.getId() )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

      outputQueryAndResults( decaffInstance, mltQuery, results );

      //using non compatible field
      try {
        qb
            .moreLikeThis()
            .comparingField( "summary" )
            .andField( "internalDescription" )
            .toEntityWithId( decaffInstance.getId() )
            .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

    Query mltQuery;
    try {
      QueryBuilder qb = getCoffeeQueryBuilder();
      Coffee decaffInstance = getDecaffInstance( qb );
      // query results to compare toEntity() results against
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntityWithId( decaffInstance.getId() )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

          .createFullTextQuery( mltQuery, Coffee.class )
          .setProjection( ProjectionConstants.THIS, ProjectionConstants.SCORE )
          .list();

      // pass entity itself in a managed state
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntity( decaffInstance )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

      copyOfDecaffInstance.setInternalDescription( nonMatchingOne.getInternalDescription() );
      copyOfDecaffInstance.setName( nonMatchingOne.getName() );
      copyOfDecaffInstance.setDescription( nonMatchingOne.getDescription() );
      copyOfDecaffInstance.setIntensity( nonMatchingOne.getIntensity() );
      copyOfDecaffInstance.setSummary( nonMatchingOne.getSummary() );
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntity( copyOfDecaffInstance )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

      copyOfDecaffInstance.setInternalDescription( decaffInstance.getInternalDescription() );
      copyOfDecaffInstance.setName( decaffInstance.getName() );
      copyOfDecaffInstance.setDescription( decaffInstance.getDescription() );
      copyOfDecaffInstance.setIntensity( decaffInstance.getIntensity() );
      copyOfDecaffInstance.setSummary( decaffInstance.getSummary() );
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntity( copyOfDecaffInstance )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

    try {
      QueryBuilder qb = getCoffeeQueryBuilder();
      Coffee decaffInstance = getDecaffInstance( qb );

      // exclude comparing entity
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntityWithId( decaffInstance.getId() )
          .createQuery();
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

          .createQuery();
      results = (List<Object[]>) fullTextSession
          .createFullTextQuery( mltQuery, Coffee.class )
          .setProjection( ProjectionConstants.THIS, ProjectionConstants.SCORE )
          .list();
      mltQuery = qb
          .moreLikeThis()
          .excludeEntityUsedForComparison()
          .comparingField( "summary" ).boostedTo( 10f )
          .andField( "description" )
          .toEntityWithId( decaffInstance.getId() )
View Full Code Here

Examples of org.hibernate.search.query.dsl.QueryBuilder.moreLikeThis()

    List<Object[]> entityResults;
    try {
      QueryBuilder qb = getCoffeeQueryBuilder();
      Coffee decaffInstance = getDecaffInstance( qb );
      // using compressed field
      mltQuery = qb
          .moreLikeThis()
          .comparingField( "brand.description" )
          .toEntityWithId( decaffInstance.getId() )
          .createQuery();
      entityResults = (List<Object[]>) fullTextSession
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.