As mentioned above, JCR Indexing is based on the Lucene indexing library as underlying search engine. It uses Directories to store index and manages access to index by Lock Factories.
By default, JCR implementation uses optimal combination of Directory implementation and Lock Factory implementation. When running on OS different from Windows, NIOFSDirectory implementation is used and SimpleFSDirectory is used for Windows stations.
NativeFSLockFactory is an optimal solution for wide variety of cases including clustered environment with NFS shared resources. However, those defaults can be overridden with the help of system properties. There are two properties that are responsible for changing default behavior:
Refer to Lucene documentation for more information, butmake sure that you know what you are changing. JCR allows end users to change implementation classes of Lucene internals, but does not guarantee its stability and functionality.
From time to time, the Lucene index needs to be optimized. The process is essentially a defragmentation. Until an optimization is triggered, Lucene only marks deleted documents, no physical deletions are applied. During the optimization process, the deletions will be applied. Optimizing the Lucene index speeds up searches but has no effect on the indexation (update) performance. First of all, ensure that repository is suspended to avoid any possible inconsistency. It is recommended to schedule optimization. Also, checking for pending deletions is supported. If it is so, it is a first signal to index optimization. All operation are available via JMX: