Package org.hibernate.search.query.facet

Examples of org.hibernate.search.query.facet.FacetingRequest


  }

  // see also HSEARCH-776
  @Test
  public void testMaxFacetCounts() throws Exception {
    FacetingRequest request = queryBuilder( Car.class ).facet()
        .name( facetName )
        .onField( indexFieldName )
        .discrete()
        .orderedBy( FacetSortOrder.COUNT_DESC )
        .maxFacetCount( 1 )
View Full Code Here


    }
  }

  @Test
  public void testUnknownFieldNameReturnsEmptyResults() {
    FacetingRequest request = queryBuilder( Car.class ).facet()
        .name( "foo" )
        .onField( "foobar" )
        .discrete()
        .createFacetingRequest();
    FullTextQuery query = queryHondaWithFacet( request );
View Full Code Here

    }
  }

  @Test
  public void testEnableDisableFacets() {
    FacetingRequest request = queryBuilder( Car.class ).facet()
        .name( facetName )
        .onField( indexFieldName )
        .discrete()
        .createFacetingRequest();
    FullTextQuery query = queryHondaWithFacet( request );
View Full Code Here

  }

  @Test
  public void testMultipleFacets() {
    final String descendingOrderedFacet = "desc";
    FacetingRequest requestDesc = queryBuilder( Car.class ).facet()
        .name( descendingOrderedFacet )
        .onField( indexFieldName )
        .discrete()
        .createFacetingRequest();

    final String ascendingOrderedFacet = "asc";
    FacetingRequest requestAsc = queryBuilder( Car.class ).facet()
        .name( ascendingOrderedFacet )
        .onField( indexFieldName )
        .discrete()
        .orderedBy( FacetSortOrder.COUNT_ASC )
        .createFacetingRequest();
View Full Code Here

  @Test
  public void testDiscreteFacetDrillDown() throws Exception {
    final String indexFieldName = "cubicCapacity";
    final String facetName = "ccs";
    Query luceneQuery = queryBuilder( Car.class ).keyword().onField( "make" ).matching( "Honda" ).createQuery();
    FacetingRequest request = queryBuilder( Car.class ).facet()
        .name( facetName )
        .onField( indexFieldName )
        .discrete()
        .createFacetingRequest();
View Full Code Here

  @Test
  public void testMultipleFacetDrillDown() throws Exception {
    final String ccsFacetName = "ccs";
    final String ccsFacetFieldName = "cubicCapacity";
    FacetingRequest ccsFacetRequest = queryBuilder( Car.class ).facet()
        .name( ccsFacetName )
        .onField( ccsFacetFieldName )
        .discrete()
        .createFacetingRequest();

    final String colorFacetName = "color";
    final String colorFacetFieldName = "color";
    FacetingRequest colorFacetRequest = queryBuilder( Car.class ).facet()
        .name( colorFacetName )
        .onField( colorFacetFieldName )
        .discrete()
        .createFacetingRequest();
View Full Code Here

  @Test
  public void testRangeFacetDrillDown() {
    final String indexFieldName = "price";
    final String priceRange = "priceRange";
    FacetingRequest rangeRequest = queryBuilder( Fruit.class ).facet()
        .name( priceRange )
        .onField( indexFieldName )
        .range()
        .from( 0.00 ).to( 1.00 )
        .from( 1.01 ).to( 1.50 )
View Full Code Here

      // build a Lucene query
      final Query query = builder.keyword().onField( "make" ).matching( queryString ).createQuery();

      // create facets for navigation
      // discrete faceting
      final FacetingRequest colorFacet = builder.facet()
          .name( colorFacetName )
          .onField( "color" )
          .discrete()
          .createFacetingRequest();
      // range faceting
      final FacetingRequest priceFacet = builder.facet()
          .name( cubicCapacityFacetName )
          .onField( "cubicCapacity" )
          .range()
          .below( 2500 ).excludeLimit()
          .from( 2500 ).to( 3000 )
View Full Code Here

    FullTextSession fullTextSession = Search.getFullTextSession( openSession() );

    FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( new MatchAllDocsQuery(), Book.class );

    QueryBuilder builder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity( Book.class ).get();
    FacetingRequest facetReq = builder.facet()
        .name( "someFacet" )
        .onField( "authors.name_untokenized" )
        .discrete()
        .orderedBy( FacetSortOrder.COUNT_DESC )
        .includeZeroCounts( false ).maxFacetCount( 10 )
View Full Code Here

  private static final String indexFieldName = "price";
  private static final String priceRange = "priceRange";

  @Test
  public void testRangeQueryForInteger() {
    FacetingRequest rangeRequest = queryBuilder( Cd.class ).facet()
        .name( priceRange )
        .onField( indexFieldName )
        .range()
        .from( 0 ).to( 1000 )
        .from( 1001 ).to( 1500 )
View Full Code Here

TOP

Related Classes of org.hibernate.search.query.facet.FacetingRequest

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.