In this section we will learn about Hibernate Search, which is used create full text index using apache Lucene engine. Then the index data can be used to run the full text search.
Introduction to Hibernate Search
Hibernate is a high performance, ORM framework that is being used to develop large-scale enterprise applications in Java technology.
Hibernate search integrates with the Java Persistence API and Apache Lucene. Apache Lucene has high performance search engine capabilities. In Hibernate Search, both the object-relational mapping capacity of JPA/Hibernate and the full text search capacity of Lucene are integrated. It mends the disadvantages of SQL query of RDBMS, which is insufficient for full text searching. Hibernate search also uses Annotations and EntityManager.
Lucene encourages Hibernate Search by bringing out its advantages over RDBMS SQL search, which can’t be used for fulltext search. Lucene covers all types of full text search and can be used to develop search facility for web sites.
Some basic key features are common in Hibernate and Lucene as both provide CRUD access to the primary data storage and define an elementary data unit: the Entity (persistence model class) in Hibernate/JPA and the Document in Lucene. Besides it, the same programming concepts like deferred commit, filter, query expression and query API- are common that functions in Hibernate / JPA and Lucene.
But, there are also some differences that recognise their own identity like- Hibernate / JPA promotes domain model-oriented programming that encourage developers to work out a rich domain-object graph while Lucene only deals with a single, built-in data model. In Hibernate / JPA, the rich domain-object graph usually represents the complexities of the real-world business through object association, inheritance, polymorphism, composition, and collections, whereas in Lucene, the built-in-data model it provides a simple document class, which simplify the search operation and even programmers, can execute complex search queries.
Uses of same persistence context in both Hibernate/JPA (Session/EntityManager) and Lucene (Document) makes indexing processes transparent to the developers enabling the deveopment around hibernate search easier.
Some of the features of Hibernate search can be described as below-
The main object of Hibernate Search includes-
Recommend the tutorial