Package org.hibernate.search

Examples of org.hibernate.search.MassIndexer


     * @param clazz the class
     * @param entityManager the entity manager
     */
    public static void reindex(Class clazz, EntityManager entityManager) {
        FullTextEntityManager txtentityManager = Search.getFullTextEntityManager(entityManager);
        MassIndexer massIndexer = txtentityManager.createIndexer(clazz);
        try {
            massIndexer.startAndWait();
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtentityManager.flushToIndexes();
        }
View Full Code Here


     * @param async true if the reindexing will be done as a background thread
     * @param entityManager the entity manager
     */
    public static void reindexAll(boolean async, EntityManager entityManager) {
        FullTextEntityManager txtentityManager = Search.getFullTextEntityManager(entityManager);
        MassIndexer massIndexer = txtentityManager.createIndexer();
        massIndexer.purgeAllOnStart(true);
        try {
            if (!async) {
                massIndexer.startAndWait();
            } else {
                massIndexer.start();
            }
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtentityManager.flushToIndexes();
View Full Code Here

     * @param clazz the class
     * @param sess the hibernate session
     */
    public static void reindex(Class clazz, Session sess) {
        FullTextSession txtSession = Search.getFullTextSession(sess);
        MassIndexer massIndexer = txtSession.createIndexer(clazz);
        try {
            massIndexer.startAndWait();
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtSession.flushToIndexes();
        }
View Full Code Here

     * @param async true if the reindexing will be done as a background thread
     * @param sess the hibernate session
     */
    public static void reindexAll(boolean async, Session sess) {
        FullTextSession txtSession = Search.getFullTextSession(sess);
        MassIndexer massIndexer = txtSession.createIndexer();
        massIndexer.purgeAllOnStart(true);
        try {
            if (!async) {
                massIndexer.startAndWait();
            } else {
                massIndexer.start();
            }
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtSession.flushToIndexes();
View Full Code Here

     */
    @Override
    public void makeInitialIndex() {
       
        FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
        MassIndexer massIndexer = fullTextEntityManager.createIndexer(DocumentModel.class);
       
        massIndexer.purgeAllOnStart(true)
                .batchSizeToLoadObjects(30)
                .threadsForSubsequentFetching(8)
                .threadsToLoadObjects(4)
                .cacheMode(CacheMode.NORMAL);
       
        massIndexer.start();
    }
View Full Code Here

  @Test
  public void testReindexedOnce() throws InterruptedException {
    Assert.assertEquals( 2, countBooksInIndex() );
    Session session = openSession();
    FullTextSession fullTextSession = Search.getFullTextSession( session );
    MassIndexer massIndexer = fullTextSession.createIndexer();
    massIndexer.startAndWait();
    session.close();
    Assert.assertEquals( 2, countBooksInIndex() );
  }
View Full Code Here

  }

  @Test
  public void testCreationOfTheDefaultMassIndexer() throws Exception {
    FullTextSession fullTextSession = builder.openFullTextSession();
    MassIndexer indexer = fullTextSession.createIndexer( Object.class );
    assertThat( indexer, instanceOf( MassIndexerImpl.class ) );
  }
View Full Code Here

    prepareEntities();
    verifyMatchExistsWithName( "name", "name" );

    Session session = openSession();
    FullTextSession fullTextSession = Search.getFullTextSession( session );
    MassIndexer massIndexer = fullTextSession.createIndexer( Root.class );
    massIndexer.startAndWait();
    verifyMatchExistsWithName( "name", "name" );
  }
View Full Code Here

    verifyMatchExistsWithName( "lazyEntity.name", TEST_NAME_CONTENT );
    verifyMatchExistsWithName( "lazyEntity2.name", TEST_NAME_CONTENT );

    FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
    MassIndexer massIndexer = fullTextSession.createIndexer( IndexedEmbeddedProxyRootEntity.class );
    massIndexer.startAndWait();
    fullTextSession.close();

    verifyMatchExistsWithName( "lazyEntity.name", TEST_NAME_CONTENT );
    verifyMatchExistsWithName( "lazyEntity2.name", TEST_NAME_CONTENT );
  }
View Full Code Here

  @Test
  public void testCreationOfTheSelectedMassIndexer() throws Exception {
    Session session = openSession();
    FullTextSession fullTextSession = Search.getFullTextSession( session );
    MassIndexer indexer = fullTextSession.createIndexer( Clock.class );

    assertThat( indexer, instanceOf( NoopMassIndexer.class ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.MassIndexer

Copyright © 2018 www.massapicom. 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.