Package org.hibernate.search

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


  public void testEnoughTime() {
    Transaction tx = fts.beginTransaction();

    FullTextQuery hibernateQuery = fts.createFullTextQuery( matchAllQuery, Clock.class );
    hibernateQuery.setTimeout( 5, TimeUnit.MINUTES );
    List results = hibernateQuery.list();
    assertFalse( hibernateQuery.hasPartialResults() );
    assertEquals( 1000, results.size() );

    tx.commit();
  }
View Full Code Here


  private void assertTimeoutOccursOnList() {
    FullTextQuery hibernateQuery = fts.createFullTextQuery( allSeikoClocksQuery, Clock.class );
    hibernateQuery.setTimeout( 10, TimeUnit.MICROSECONDS );
    try {
      hibernateQuery.list();
      fail( "timeout exception should happen" );
    }
    catch (QueryTimeoutException e) {
      //good
    }
View Full Code Here

    fts.clear();
  }

  private void assertCorrectNumberOfClocksNoTimeout() {
    FullTextQuery hibernateQuery = fts.createFullTextQuery( allSeikoClocksQuery, Clock.class );
    final List results = hibernateQuery.list();
    assertEquals( 500, results.size() );
    fts.clear();
  }

  /**
 
View Full Code Here

  }

  private void assertExecutionTimeoutHasNoPartialResult() {
    FullTextQuery hibernateQuery = fts.createFullTextQuery( allSeikoClocksQuery, Clock.class );
    hibernateQuery.limitExecutionTimeTo( 30, TimeUnit.SECONDS );
    List results = hibernateQuery.list();
    assertEquals( "Test below limit termination", 500, results.size() );
    assertFalse( hibernateQuery.hasPartialResults() );
    fts.clear();
  }
View Full Code Here

  }

  private void assertExecutionTimeoutOccursOnList() {
    FullTextQuery hibernateQuery = fts.createFullTextQuery( allSwatchClocksQuery, Clock.class );
    hibernateQuery.limitExecutionTimeTo( 1, TimeUnit.NANOSECONDS );
    List result = hibernateQuery.list();
    System.out.println( "Result size early: " + result.size() );
    assertEquals( "Test early failure, before the number of results are even fetched", 0, result.size() );
    if ( result.size() == 0 ) {
      //sometimes, this
      assertTrue( hibernateQuery.hasPartialResults() );
View Full Code Here

    List<Facet> facetList = facetManager.getFacets( facetName );
    assertFacetCounts( facetList, new int[] { 5, 4, 4, 0 } );

    facetManager.getFacetGroup( facetName ).selectFacets( facetList.get( 0 ) );
    query.list();
    assertEquals( "Wrong number of query matches", 5, query.getResultSize() );
    List<Facet> newFacetList = facetManager.getFacets( facetName );
    assertFacetCounts( newFacetList, new int[] { 5, 0, 0, 0 } );

    facetManager.getFacetGroup( facetName ).selectFacets( facetList.get( 1 ) );
View Full Code Here

    List<Facet> newFacetList = facetManager.getFacets( facetName );
    assertFacetCounts( newFacetList, new int[] { 5, 0, 0, 0 } );

    facetManager.getFacetGroup( facetName ).selectFacets( facetList.get( 1 ) );
    query.setMaxResults( Integer.MAX_VALUE );
    assertEquals( "Wrong number of query matches", 9, query.list().size() );
    newFacetList = facetManager.getFacets( facetName );
    assertFacetCounts( newFacetList, new int[] { 5, 4, 0, 0 } );
  }

  @Test
View Full Code Here

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

    facetManager.getFacetGroup( priceRange ).selectFacets( facets.get( 2 ) );

    assertEquals( "Wrong number of query matches", 2, query.list().size() );
    List<Facet> newFacetList = facetManager.getFacets( priceRange );
    assertFacetCounts( newFacetList, new int[] { 2, 0, 0, 0 } );
  }

  @Override
View Full Code Here

    resetFieldSelector();
    Transaction tx = fullTextSession.beginTransaction();
    TermQuery ftQuery = new TermQuery( new Term( "stops.roadName", analyzedRoadname ) );
    FullTextQuery query = fullTextSession.createFullTextQuery( ftQuery, BusLine.class );
    query.setProjection( "busLineName" );
    assertEquals( 1, query.list().size() );
    List results = query.list();
    try {
      assertFieldSelectorEnabled( "busLineName" );
    }
    catch (IOException e) {
View Full Code Here

    Transaction tx = fullTextSession.beginTransaction();
    TermQuery ftQuery = new TermQuery( new Term( "stops.roadName", analyzedRoadname ) );
    FullTextQuery query = fullTextSession.createFullTextQuery( ftQuery, BusLine.class );
    query.setProjection( "busLineName" );
    assertEquals( 1, query.list().size() );
    List results = query.list();
    try {
      assertFieldSelectorEnabled( "busLineName" );
    }
    catch (IOException e) {
      fail( "unexpected exception " + e );
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.