Package org.hibernate.search

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


    parser = new QueryParser( TestConstants.getTargetLuceneVersion(), "id", TestConstants.stopAnalyzer );
    result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
    assertEquals( 0, result.size() );
    result = s.createCriteria( Email.class ).list();
    for ( int i = 0; i < loop / 2; i++ ) {
      s.index( result.get( i ) );
    }
    tx.commit(); //do the process
    s.index( result.get( loop / 2 ) ); //do the process out of tx
    tx = s.beginTransaction();
    for ( int i = loop / 2 + 1; i < loop; i++ ) {
View Full Code Here


    result = s.createCriteria( Email.class ).list();
    for ( int i = 0; i < loop / 2; i++ ) {
      s.index( result.get( i ) );
    }
    tx.commit(); //do the process
    s.index( result.get( loop / 2 ) ); //do the process out of tx
    tx = s.beginTransaction();
    for ( int i = loop / 2 + 1; i < loop; i++ ) {
      s.index( result.get( i ) );
    }
    tx.commit(); //do the process
View Full Code Here

    }
    tx.commit(); //do the process
    s.index( result.get( loop / 2 ) ); //do the process out of tx
    tx = s.beginTransaction();
    for ( int i = loop / 2 + 1; i < loop; i++ ) {
      s.index( result.get( i ) );
    }
    tx.commit(); //do the process
    s.close();

    s = Search.getFullTextSession( openSession() );
View Full Code Here

    s = Search.getFullTextSession( openSession() );
    tx = s.beginTransaction();
    //object never indexed
    Email email = (Email) s.get( Email.class, Long.valueOf( loop + 1 ) );
    s.index( email );
    tx.commit();
    s.close();

    //check non indexed object get indexed by s.index
    s = Search.getFullTextSession( openSession() );
View Full Code Here

    s.close();

    s = getSessionWithAutoCommit();
    ent = (Entite) s.get( Entite.class, ent.getId() );
    session = Search.getFullTextSession( s );
    session.index( ent );
    s.close();

    s = getSessionWithAutoCommit();
    session = Search.getFullTextSession( s );
    luceneQuery = new TermQuery( new Term( "categorie.nom", "livre" ) );
View Full Code Here

    s = getSessionWithAutoCommit();
    Iterator it = s.createQuery( "from Entite where id = :id").setParameter( "id", ent.getId() ).iterate();
    session = Search.getFullTextSession( s );
    while ( it.hasNext() ) {
      ent = (Entite) it.next();
      session.index( ent );
    }
    s.close();

    s = getSessionWithAutoCommit();
    session = Search.getFullTextSession( s );
View Full Code Here

    ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
      final Email o = (Email) results.get( 0 );
      s.index( o );
      if ( index % 5 == 0 ) {
        s.flushToIndexes();
        s.clear();
      }
    }
View Full Code Here

        .setFetchSize( BATCH_SIZE )
        .scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
      fullTextSession.index( results.get( 0 ) );
      if ( index % BATCH_SIZE == 0 ) {
        fullTextSession.flushToIndexes();
        fullTextSession.clear();
      }
    }
View Full Code Here

    QueryParser parser = new QueryParser("id", new StopAnalyzer() );
    List result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
    assertEquals( 0, result.size() );
    result = s.createCriteria( Email.class ).list();
    for (int i = 0 ; i < loop/2 ; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    s.index( result.get(loop/2) ); //do the process out of tx
    tx = s.beginTransaction();
    for (int i = loop/2+1 ; i < loop; i++)
      s.index( result.get( i ) );
View Full Code Here

    assertEquals( 0, result.size() );
    result = s.createCriteria( Email.class ).list();
    for (int i = 0 ; i < loop/2 ; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    s.index( result.get(loop/2) ); //do the process out of tx
    tx = s.beginTransaction();
    for (int i = loop/2+1 ; i < loop; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    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.