@Test public void testPurgeSearchIndex() { final int fetchSize = 938; final int flushSize = 888; context.checking(new Expectations() { { one(fullTextSessionMock).purgeAll(SearchIndexManagerTest.class); one(fullTextSessionMock).flushToIndexes(); one(fullTextSessionMock).getSearchFactory(); will(returnValue(searchFactoryMock)); one(searchFactoryMock).optimize(SearchIndexManagerTest.class); one(fullTextSessionMock).flushToIndexes(); } }); SearchIndexManager indexer = new SearchIndexManager(fetchSize, flushSize); indexer.purgeSearchIndex(SearchIndexManagerTest.class, fullTextSessionMock); context.assertIsSatisfied(); }
@SuppressWarnings("unchecked") public void purgeSearchIndex(final Class entityClass, final FullTextSession search) { log.info("purgeSearchIndex(" + entityClass.toString() + ")"); String entityName = entityClass.toString().substring(entityClass.toString().lastIndexOf('.') + 1); log.info("Purging indexed data for " + entityName); search.purgeAll(entityClass); search.flushToIndexes(); log.info("Optimizing index for " + entityName); search.getSearchFactory().optimize(entityClass); search.flushToIndexes(); }
SearchIndexManager { @SuppressWarnings("unchecked") public void purgeSearchIndex(final Class entityClass, final FullTextSession search) { log.info("purgeSearchIndex(" + entityClass.toString() + ")"); String entityName = entityClass.toString().substring(entityClass.toString().lastIndexOf('.') + 1); log.info("Purging indexed data for " + entityName); search.purgeAll(entityClass); search.flushToIndexes(); log.info("Optimizing index for " + entityName); search.getSearchFactory().optimize(entityClass); search.flushToIndexes(); } }
SearchIndexManager { @SuppressWarnings("unchecked") public void purgeSearchIndex(final Class entityClass, final FullTextSession search) { log.info("purgeSearchIndex(" + entityClass.toString() + ")"); String entityName = entityClass.toString().substring(entityClass.toString().lastIndexOf('.') + 1); log.info("Purging indexed data for " + entityName); search.purgeAll(entityClass); search.flushToIndexes(); log.info("Optimizing index for " + entityName); search.getSearchFactory().optimize(entityClass); search.flushToIndexes(); } SearchIndexManager(final Integer inFetchBatchSize, final Integer inFlushBatchSize); }
SearchIndexManager { @SuppressWarnings("unchecked") public void purgeSearchIndex(final Class entityClass, final FullTextSession search) { log.info("purgeSearchIndex(" + entityClass.toString() + ")"); String entityName = entityClass.toString().substring(entityClass.toString().lastIndexOf('.') + 1); log.info("Purging indexed data for " + entityName); search.purgeAll(entityClass); search.flushToIndexes(); log.info("Optimizing index for " + entityName); search.getSearchFactory().optimize(entityClass); search.flushToIndexes(); } SearchIndexManager(final Integer inFetchBatchSize, final Integer inFlushBatchSize); @SuppressWarnings("unchecked") void reindexEntities(final Class entityClass, final FullTextSession search); @SuppressWarnings("unchecked") void reindexEntities(final Class entityClass, final String entityName, final FullTextSession search); @SuppressWarnings("unchecked") void purgeSearchIndex(final Class entityClass, final FullTextSession search); }
SearchIndexManager { @SuppressWarnings("unchecked") public void purgeSearchIndex(final Class entityClass, final FullTextSession search) { log.info("purgeSearchIndex(" + entityClass.toString() + ")"); String entityName = entityClass.toString().substring(entityClass.toString().lastIndexOf('.') + 1); log.info("Purging indexed data for " + entityName); search.purgeAll(entityClass); search.flushToIndexes(); log.info("Optimizing index for " + entityName); search.getSearchFactory().optimize(entityClass); search.flushToIndexes(); } SearchIndexManager(final Integer inFetchBatchSize, final Integer inFlushBatchSize); @SuppressWarnings("unchecked") void reindexEntities(final Class entityClass, final FullTextSession search); @SuppressWarnings("unchecked") void reindexEntities(final Class entityClass, final String entityName, final FullTextSession search); @SuppressWarnings("unchecked") void purgeSearchIndex(final Class entityClass, final FullTextSession search);  }