SHARE
TWEET

Untitled

a guest Jun 26th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Service
  2. public class HibernateSearchService {
  3.  
  4. private final EntityManager entityManager;
  5.  
  6. @Autowired
  7. public HibernateSearchService(final EntityManagerFactory entityManagerFactory) {
  8.     this.entityManager = entityManagerFactory.createEntityManager();
  9. }
  10.  
  11. @PostConstruct
  12. public void initialiseHibernateSearch() {
  13.         System.out.println("About to initalise search");
  14.     try {
  15.         FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
  16.         fullTextEntityManager.createIndexer().startAndWait();
  17.     } catch (InterruptedException e) {
  18.         e.printStackTrace();
  19.     }
  20.   }
  21. }
  22.      
  23. hibernate.search.default.directory_provider = filesystem
  24. hibernate.search.default.indexBase = /data/index/default
  25.      
  26. [ntifierloader-1] o.h.s.b.i.SimpleIndexingProgressMonitor  : HSEARCH000027: Going to reindex 4 entities
  27. [  restartedMain] o.h.s.b.i.SimpleIndexingProgressMonitor  : HSEARCH000028: Reindexed 4 entities
  28.      
  29. @Transactional
  30. public class HibernateSearchService {
  31.  
  32. EntityManager entityManager;
  33.  
  34. @PostConstruct
  35. public void initialiseHibernateSearch() {
  36.         System.out.println("About to initalise search");
  37.     try {
  38.         FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
  39.         fullTextEntityManager.createIndexer().startAndWait();
  40.     } catch (InterruptedException e) {
  41.         e.printStackTrace();
  42.     }
  43.   }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top