Package org.hibernate.search

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


                int i = 0;
                while (true) {
                    i++;
                    Object o = cursor.get(0);
                    log.debug("indexing instance " + i + ": " + o);
                    ftSession.index(o);
                    if (i % batchSize == 0) {
                        log.debug("ending batch, beginning new batch");
                        ftSession.clear(); // Clear persistence context for each batch
                    }
                    progress.setPercentComplete( new Double(100d/count*i).intValue() );
View Full Code Here


            .setFetchMode("actors", FetchMode.JOIN)
            .setFetchMode("categories", FetchMode.JOIN)
            .list();
      for (Object obj : results)
      {
         fullTextSession.index(obj);
      }
   }

   private FullTextSession getFullTextSession()
   {
View Full Code Here

      FullTextSession fullTextSession = getFullTextSession();
      for (Class entityType : entityTypes)
      {
         for (Object obj : fullTextSession.createCriteria(entityType).list())
         {
            fullTextSession.index(obj);
         }
      }
   }

   @Remove
View Full Code Here

    private void index() {
        FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession((Session) em.getDelegate());
        List results = ftSession.createCriteria(Book.class).list();
        for (Object obj : results) {
            ftSession.index(obj);
        }
    ftSession.flushToIndexes();
    }

    private void purge() {
View Full Code Here

    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 ) );
      if ( index % 5 == 0 ) s.clear();
    }
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
View Full Code Here

    parser = new QueryParser( "id", new 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++)
      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

      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();

    s = Search.getFullTextSession( openSession() );
    tx = s.beginTransaction();
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 = new FullTextSessionImpl( openSession() );
View Full Code Here

    s.close();

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

    s = openSession();
    session = Search.getFullTextSession( s );
    luceneQuery = new TermQuery( new Term( "categorie.nom", "livre" ) );
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.