When executing a query, Hibernate Search interacts with the Apache Lucene indexes through a reader strategy. Choosing a reader strategy will depend on the profile of the application (frequent updates, read mostly, asynchronous index update etc). See also Section 3.6, “Reader strategy configuration”
With this strategy, Hibernate Search will share the same
IndexReader
, for a given Lucene index, across
multiple queries and threads provided that the
IndexReader
is still up-to-date. If the
IndexReader
is not up-to-date, a new one is
opened and provided. Each IndexReader
is made of
several SegmentReader
s. This strategy only
reopens segments that have been modified or created after last opening
and shares the already loaded segments from the previous instance. This
strategy is the default.
The name of this strategy is shared
.
Every time a query is executed, a Lucene
IndexReader
is opened. This strategy is not the
most efficient since opening and warming up an
IndexReader
can be a relatively expensive
operation.
The name of this strategy is not-shared
.