Package org.hibernate.search.query.engine.spi

Examples of org.hibernate.search.query.engine.spi.FacetManager


        .onField( "horsePower" )
        .range()
        .below( 1000 )
        .createFacetingRequest();
    FullTextQuery query = createMatchAllQuery( Truck.class );
    FacetManager facetManager = query.getFacetManager();
    query.getFacetManager().enableFaceting( rangeRequest );

    List<Facet> facets = facetManager.getFacets( facetingName ); // OK
    facets = facetManager.getFacets( facetingName ); // Still OK
    assertFacetCounts( facets, new int[] { 4 } );

    facetManager.getFacetGroup( facetingName ).selectFacets( facets.get( 0 ) ); //narrow search on facet
    facets = facetManager.getFacets( facetingName ); // Exception...
    assertFacetCounts( facets, new int[] { 4 } );
  }
View Full Code Here


        .from( 1.01 ).to( 1.50 )
        .from( 1.51 ).to( 3.00 )
        .from( 4.00 ).to( 5.00 )
        .createFacetingRequest();
    FullTextQuery query = createMatchAllQuery( Fruit.class );
    FacetManager facetManager = query.getFacetManager();
    facetManager.enableFaceting( rangeRequest );

    List<Facet> facets = facetManager.getFacets( priceRange );
    assertFacetCounts( facets, new int[] { 5, 3, 2, 0 } );
  }
View Full Code Here

        .includeZeroCounts( false )
        .orderedBy( FacetSortOrder.COUNT_ASC )
        .createFacetingRequest();

    FullTextQuery query = createMatchAllQuery( Fruit.class );
    FacetManager facetManager = query.getFacetManager();
    facetManager.enableFaceting( rangeRequest );

    List<Facet> facets = query.getFacetManager().getFacets( priceRange );
    assertFacetCounts( facets, new int[] { 2, 3, 5 } );
    assertEquals( "[0.0, 1.0]", facets.get( 0 ).getValue() );
    assertEquals( "[1.01, 1.5]", facets.get( 1 ).getValue() );
View Full Code Here

        .orderedBy( FacetSortOrder.RANGE_DEFINITION_ORDER )
        .maxFacetCount( 5 )
        .createFacetingRequest();

    FullTextQuery query = createMatchAllQuery( Fruit.class );
    FacetManager facetManager = query.getFacetManager();
    facetManager.enableFaceting( rangeRequest );

    List<Facet> facets = query.getFacetManager().getFacets( priceRange );
    assertFacetCounts( facets, new int[] { 2, 3, 5 } );
    assertEquals( "[0.0, 1.0]", facets.get( 0 ).getValue() );
    assertEquals( "[1.01, 1.5]", facets.get( 1 ).getValue() );
View Full Code Here

        .from( "S" ).to( "U" )
        .above( "U" ).excludeLimit()
        .orderedBy( FacetSortOrder.RANGE_DEFINITION_ORDER )
        .createFacetingRequest();
    FullTextQuery query = createMatchAllQuery( Cd.class );
    FacetManager facetManager = query.getFacetManager();
    facetManager.enableFaceting( rangeRequest );

    List<Facet> facets = facetManager.getFacets( facetingName );
    assertFacetCounts( facets, new int[] { 7, 1, 2 } );

    facetManager.getFacetGroup( facetingName ).selectFacets( facets.get( 0 ) );
    facets = facetManager.getFacets( facetingName );
    assertFacetCounts( facets, new int[] { 7, 0, 0 } );
  }
View Full Code Here

        .from( formatter.parse( "1990" ) ).to( formatter.parse( "1999" ) )
        .above( formatter.parse( "2000" ) ).excludeLimit()
        .orderedBy( FacetSortOrder.RANGE_DEFINITION_ORDER )
        .createFacetingRequest();
    FullTextQuery query = createMatchAllQuery( Cd.class );
    FacetManager facetManager = query.getFacetManager();
    facetManager.enableFaceting( rangeRequest );

    List<Facet> facets = facetManager.getFacets( facetingName );
    assertFacetCounts( facets, new int[] { 1, 2, 2, 0, 5 } );

    facetManager.getFacetGroup( facetingName ).selectFacets( facets.get( 4 ) );
    facets = facetManager.getFacets( facetingName );
    assertFacetCounts( facets, new int[] { 0, 0, 0, 0, 5 } );
  }
View Full Code Here

      luceneQuery = SpatialQueryBuilderFromCoordinates.buildSpatialQueryByHash( center, radius, "location" );
      hibQuery = fullTextSession.createFullTextQuery( luceneQuery, POI.class );
      hibQuery.setProjection( "id", "name", "type" );

      FacetManager facetManager = hibQuery.getFacetManager();

      QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity( POI.class ).get();

      FacetingRequest facetingRequest = queryBuilder.facet()
          .name( "typeFacet" )
          .onField( "type" )
          .discrete()
          .orderedBy( FacetSortOrder.COUNT_DESC )
          .includeZeroCounts( false )
          .createFacetingRequest();

      facetManager.enableFaceting( facetingRequest );

      Integer size = hibQuery.getResultSize();

      List list = hibQuery.list();

      List<Facet> facets = facetManager.getFacets( "typeFacet" );

      System.out.println( facets );

      session.getTransaction().commit();
      session.close();
View Full Code Here

TOP

Related Classes of org.hibernate.search.query.engine.spi.FacetManager

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.