Package org.hibernate.search.jpa

Examples of org.hibernate.search.jpa.FullTextEntityManager.flushToIndexes()


        try {
            massIndexer.startAndWait();
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtentityManager.flushToIndexes();
        }
    }

    /**
     * Regenerates all the indexed class indexes
View Full Code Here


                massIndexer.start();
            }
        } catch (InterruptedException e) {
            log.error("mass reindexing interrupted: " + e.getMessage());
        } finally {
            txtentityManager.flushToIndexes();
        }
    }
}
View Full Code Here

  private void purgeAll(Class<?>... entityTypes) throws Exception {
    FullTextEntityManager fullTextEm = Search.getFullTextEntityManager( createEntityManager() );
    for ( Class<?> entityType : entityTypes ) {
      fullTextEm.purgeAll( entityType );
      fullTextEm.flushToIndexes();
    }
    int numDocs = fullTextEm.getSearchFactory().getIndexReaderAccessor().open( entityTypes ).numDocs();
    close( fullTextEm );
    assertThat( numDocs ).isEqualTo( 0 );
  }
View Full Code Here

     * Flush search indexes, to be done after a reindex() or reindexAll() operation
     */
    public void flushSearchIndexes() {
        EntityManagerFactory entityManagerFactory = (EntityManagerFactory) applicationContext.getBean("entityManagerFactory");
        FullTextEntityManager fullTextEntityMgr = Search.getFullTextEntityManager(entityManagerFactory.createEntityManager());
        fullTextEntityMgr.flushToIndexes();
    }
}
View Full Code Here

  }

  private void purge() {
    FullTextEntityManager ftEm = org.hibernate.search.jpa.Search.getFullTextEntityManager( em );
    ftEm.purgeAll( Book.class );
    ftEm.flushToIndexes();
    ftEm.close();
    emf.close();
  }

  private List<Book> search(String searchQuery) throws ParseException {
View Full Code Here

  @After
  public void tearDown() {
    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager( entityManager );
    fullTextEntityManager.purgeAll( Book.class );
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.close();
    super.tearDown();
  }

  @Test
View Full Code Here

    // verify against index
    assertEquals( 1, countBretzelsViaIndex( em ) );
    em.purgeAll( Bretzel.class );

    // clear index
    em.flushToIndexes();

    // verify Bretzel removed from index
    assertEquals( 0, countBretzelsViaIndex( em ) );

    // re-index
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.