hibernate search without database

前端 未结 3 769
猫巷女王i
猫巷女王i 2021-01-23 08:29

Is it possible to use hibernate-search only for it\'s annotations (bean => document/document => bean mapping), without using a database at all? If so, are there any online sampl

3条回答
  •  天涯浪人
    2021-01-23 08:43

    Starman is correct, Hibernate Search in version 3.4 is abstracting the search engine from Hibernate Core, and the Infinispan Query is an integration example which works fine without a database. There would be no problems with Spring either, but you'd need to make sure to send update event to the query engine so that the index doesn't get out of synch. When using Hibernate the advantage is that it transparently listens for changes to the database and applies them to the index at transaction commit, so the index is always in synch (or close, if configuring Search to use async backends).

    I'd suggest to look into the code of Infinispan Query, as it's very small and just delegating calls to expose an Infinispan flavoured API. Most of the code is tests or integration to properly manage the lifecycle of the engine: start and stop it together with Infinispan.

提交回复
热议问题