Package org.hibernate.search

Examples of org.hibernate.search.FullTextSession.createQuery()


        "incorrect document returned",
        ( ( BoostedGetDescriptionLibrary ) results.get( 0 ) ).getDescription().startsWith( "Martians" )
    );

    //cleanup
    for ( Object element : fullTextSession.createQuery( "from " + BoostedGetDescriptionLibrary.class.getName() )
        .list() ) {
      fullTextSession.delete( element );
    }
    tx.commit();
    fullTextSession.close();
View Full Code Here


    //System.out.println( hibQuery.explain( 0 ) );
    //System.out.println( hibQuery.explain( 1 ) );

    //cleanup
    for ( Object element : fullTextSession.createQuery( "from " + BoostedFieldDescriptionLibrary.class.getName() )
        .list() ) {
      fullTextSession.delete( element );
    }
    tx.commit();
    fullTextSession.close();
View Full Code Here

        "incorrect document returned",
        ( ( BoostedDescriptionLibrary ) results.get( 0 ) ).getDescription().startsWith( "Martians" )
    );

    //cleanup
    for ( Object element : fullTextSession.createQuery( "from " + BoostedDescriptionLibrary.class.getName() )
        .list() ) {
      fullTextSession.delete( element );
    }
    tx.commit();
    fullTextSession.close();
View Full Code Here

    hibQuery.setMaxResults( 3 );
    result = hibQuery.list();
    assertNotNull( result );
    assertEquals( "first result out of limit", 0, result.size() );

    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testIterator() throws Exception {
View Full Code Here

    hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    result = hibQuery.iterate();
    assertNotNull( result );
    assertFalse( result.hasNext() );

    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testScrollableResultSet() throws Exception {
View Full Code Here

    assertFalse( result.scroll( 1 ) );
    result.beforeFirst();
    while ( result.next() ) {
      s.delete( result.get()[0] );
    }
    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  // Technically this is checked by other tests but let's do it anyway. J.G.
View Full Code Here

    projections.next();
    assertTrue( projections.isFirst() );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeLargerThanHits() throws Exception {
View Full Code Here

    results.next();
    Object[] result = results.get();
    assertEquals( "incorrect entityInfo returned", 1000, result[0] );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeDefaultFirstAndMax() throws Exception {
View Full Code Here

    results.scroll( -2 );
    result = results.get();
    assertEquals( "incorrect entityInfo returned", 1002, result[0] );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeNonDefaultFirstAndMax() throws Exception {
View Full Code Here

    results.scroll( 10 );
    result = results.get();
    assertNull( result );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeNonDefaultFirstAndMaxNoHits() throws Exception {
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.