Package org.hibernate.search

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


  public void testScrollEmptyHits() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:XXX" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
View Full Code Here


   */
  public void testPurgeUnIndexClass() throws Exception {
    createTestData();
    FullTextSession s = Search.getFullTextSession( openSession() );

    Transaction tx = s.beginTransaction();
    assertNumberOfAnimals( s, 5 );
    tx.commit();

    tx = s.beginTransaction();
    try {
View Full Code Here

    Transaction tx = s.beginTransaction();
    assertNumberOfAnimals( s, 5 );
    tx.commit();

    tx = s.beginTransaction();
    try {
      s.purgeAll( String.class );
      tx.commit();
      fail();
    }
View Full Code Here

    assertEquals( "Wrong number of hits. There should be one elephant and one shark.", count, result.size() );
  }

  private void createTestData() {
    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();

    Fish shark = new Fish();
    shark.setName( "White Pointer" );
    shark.setNumberOfDorsalFins( 2 );
    shark.setWeight( 1500 );
View Full Code Here

  public void testListEmptyHits() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:XXX" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    List result = hibQuery.list();
View Full Code Here

  public void testIterateEmptyHits() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:XXX" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    Iterator iter = hibQuery.iterate();
View Full Code Here

*/
public class MassIndexTest extends SearchTestCase {

  public void testBatchSize() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    int loop = 14;
    for (int i = 0; i < loop; i++) {
      Statement statmt = s.connection().createStatement();
      statmt.executeUpdate( "insert into Domain(id, name) values( + "
          + ( i + 1 ) + ", 'sponge" + i + "')" );
View Full Code Here

    tx.commit();
    s.close();

    //check non created object does get found!!1
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
      s.index( results.get( 0 ) );
View Full Code Here

      s.index( results.get( 0 ) );
      if ( index % 5 == 0 ) s.clear();
    }
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
    List result = s.createFullTextQuery( parser.parse( "body:create" ) ).list();
    assertEquals( 14, result.size() );
    for (Object object : result) {
      s.delete( object );
View Full Code Here

  }


  public void testTransactional() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    int loop = 4;
    for (int i = 0; i < loop; i++) {
      Email email = new Email();
      email.setId( (long) i + 1 );
      email.setTitle( "JBoss World Berlin" );
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.