I had to solve problem with re-indexing recipes for my own russian cooking portal cook365.ru when I add new entries from MySql dump to database on live server. So I added this method in my service implementation class.
@Transactional
public List<Recipe> reindexAll() {
List<Recipe> recipes = recipeDao.findAll();
EntityManager entityManager = entityManagerFactory.createEntityManager();
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
for (Recipe recipe : recipes) {
recipe = fullTextEntityManager.merge(recipe);
fullTextEntityManager.index(recipe);
}
fullTextEntityManager.flushToIndexes();
return recipes;
}
At first time I didn't added fullTextEntityManager.flushToIndexes(); and indexes were not updated, spent some time to figure out the problem.