Search code examples
javahibernatelucenefull-text-searchhibernate-search

Prevent initialization of Hibernate Search in Spring application


I have a Model class which is shared between two applications. One of the application needs to support full text search which has been implemented using hibernate search. The other application does not need this search capability. The problem is that when I startup my spring application the index directories are created automatically. Is there any way I can prevent these index directories from being created in the other application?


Solution

  • In Hibernate Search 6+, set the configuration property hibernate.search.enabled to false for the application you don't want to use Hibernate Search in.

    In Hibernate Search 5, set the configuration property hibernate.search.autoregister_listeners to false for the application you don't want to use Hibernate Search in.

    Source: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#search-configuration-event