Book Image

Lucene 4 Cookbook

By : Edwood Ng, Vineeth Mohan
Book Image

Lucene 4 Cookbook

By: Edwood Ng, Vineeth Mohan

Overview of this book

Table of Contents (16 chapters)
Lucene 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Maintaining search sessions with SearcherLifetimeManager


This is another utility class that Lucene provides out of the box, providing a facility to manage multiple IndexSearchers. Why do we need multiple IndexSearchers? Let's imagine we have multiple users in a high traffics NRT search application, searching concurrently. Also, let's assume that some of these users are also submitting changes to the index at the same time. If we periodically refresh our IndexSearcher for a NRT search, we will likely encounter a scenario where a user is paginating through a result set and at the same time, the index is updated affecting the search result. The effect can be minimal if the newly added/updated content is irrelevant to the current search terms. However, if the new content has any relevancy to the current search, the search result rankings will change. The user may see repeated results between the pages as user paginating. To ensure a good user experience, we should reuse the same IndexSearcher...