Book Image

Hibernate Search by Example

By : Steve Perkins
Book Image

Hibernate Search by Example

By: Steve Perkins

Overview of this book

<p>Users expect software to be highly intelligent when searching data. Searches should span across multiple data points at once, and be able to spot patterns and groupings in the results found. Searches should be able to fix user typos, and use terms related to the user’s search words. Searching is at its best when it pleasantly surprises us, seeming to understand the real gist of what we’re looking for better than we understood it ourselves! Where can we find such a search system and how can we use it efficiently? <br /><br />Hibernate Search by Example is a practical, step-by-step tutorial, which guides you from the basics of Hibernate Search to its advanced features. The book builds toward a complete sample application, slowly fleshed out to demonstrate each and every concept being introduced in each chapter. By the end you will have a solid foundation for using Hibernate Search in real production applications.<br /><br />This book starts with a simple example, and incrementally builds upon it to showcase each Hibernate Search feature introduced. By the end of the book you will have a working, functionality-rich application, and a deeper understanding than you might have had from looking at code snippets in a vacuum.</p> <p>You will learn how to integrate search into core Hibernate applications, whether they are XML or annotation-based, or if you are using JPA. You will see how to fine-tune the relevance of search results, and design searches that can account for user typos or automatically reach for related terms. We will take advantage of performance optimization strategies, from running Hibernate Search in a cluster to reducing the need for database access at all.</p> <p>Hibernate Search by Example provides everything you need to know to incorporate search functionality into your own custom applications.</p>
Table of Contents (14 chapters)
Hibernate Search by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Automatic versus manual indexing


So far, we really haven't had to think much about the timing of when entities are indexed. After all, Hibernate Search is tightly integrated with Hibernate ORM. By default, the add-on updates Lucene whenever the core updates the database.

However, you have the option of decoupling these operations, and indexing manually if you like. Some common situations where you might consider a manual approach are as follows:

  • If you can easily live with Lucene being out of sync for limited periods, you might want to defer indexing operations until off-peak hours, to reduce system load during times of peak usage.

  • If you want to use conditional indexing, but are not comfortable with the experimental nature of EntityIndexingInterceptor (refer to Chapter 4, Advanced Mapping), you might use manual indexing as an alternative approach.

  • If your database may be updated directly, by processes that do not go through Hibernate ORM, you must manually update your Lucene indexes regularly...