Package org.hibernate.search

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


    hibQuery = s.createFullTextQuery( query, Employee.class ).setFirstResult( 10 ).setMaxResults( 20 );
    result = hibQuery.list();
    assertEquals( 0, result.size() );

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

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


    hibQuery = s.createFullTextQuery( query, Employee.class ).setFirstResult( 10 ).setMaxResults( 20 );
    iter = hibQuery.iterate();
    assertFalse( iter.hasNext() );

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

  private void prepEmployeeIndex(FullTextSession s) {
View Full Code Here

    projections.scroll( -5 );
    projection = projections.get();
    assertNull( projection );

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

    List<String> result = hibQuery.list();
    assertTrue( "incorrect transformation", result.get( 0 ).startsWith( "1000, Griffin, ITech" ) );
    assertTrue( "incorrect transformation", result.get( 1 ).startsWith( "1002, Jimenez, ITech" ) );

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

    assertEquals(
        "incorrect transformation", "1002", ( ( Document ) map.get( FullTextQuery.DOCUMENT ) ).get( "id" )
    );

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

      assertEquals( "DOCUMENT size incorrect", 4, ( ( Document ) projection[5] ).getFields().size() );
    }
    assertEquals( "incorrect number of results returned", 4, counter );

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

    assertEquals( "dept incorrect", "Accounting", projection[7] );
    assertNotNull( "Date", projection[8] );
    assertNotNull( "Lucene internal doc id", projection[9] );

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

    assertTrue( "THIS incorrect", projection[0] instanceof Employee );
    assertTrue( "SCORE incorrect", projection[1] instanceof Float );
    assertEquals( "last name incorrect", "Jackson", projection[3] );

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

    assertEquals( 1, result.size() );
    projection = ( Object[] ) result.get( 0 );
    assertEquals( "mainAuthor.name", null, projection[2] );

    //cleanup
    for ( Object element : s.createQuery( "from " + Book.class.getName() ).list() ) {
      s.delete( element );
    }
    for ( Object element : s.createQuery( "from " + Author.class.getName() ).list() ) {
      s.delete( element );
    }
View Full Code Here

    //cleanup
    for ( Object element : s.createQuery( "from " + Book.class.getName() ).list() ) {
      s.delete( element );
    }
    for ( Object element : s.createQuery( "from " + Author.class.getName() ).list() ) {
      s.delete( element );
    }
    tx.commit();
    s.close();
  }
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.