Class IndexSearcherWrapper

  • public class IndexSearcherWrapper
    extends java.lang.Object
    Extension point to add custom functionality at request time to the DirectoryReader and IndexSearcher managed by the IndexShard.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.apache.lucene.index.DirectoryReader wrap​(org.apache.lucene.index.DirectoryReader reader)
      Wraps the given DirectoryReader.
      protected wrap​( searcher)  
      Engine.Searcher wrap​(Engine.Searcher engineSearcher)
      If there are configured IndexSearcherWrapper instances, the IndexSearcher of the provided engine searcher gets wrapped and a new Engine.Searcher instances is returned, otherwise the provided Engine.Searcher is returned.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IndexSearcherWrapper

        public IndexSearcherWrapper()
    • Method Detail

      • wrap

        protected org.apache.lucene.index.DirectoryReader wrap​(org.apache.lucene.index.DirectoryReader reader)
        Wraps the given DirectoryReader. The wrapped reader can filter out document just like delete documents etc. but must not change any term or document content.

        NOTE: The wrapper has a per-request lifecycle, must delegate IndexReader.getReaderCacheHelper(), LeafReader.getCoreCacheHelper() and must be an instance of FilterDirectoryReader that eventually exposes the original reader via FilterDirectoryReader.getDelegate(). The returned reader is closed once it goes out of scope.

        reader - The provided directory reader to be wrapped to add custom functionality
        a new directory reader wrapping the provided directory reader or if no wrapping was performed the provided directory reader
      • wrap

        protected wrap​( searcher)
        searcher - The provided index searcher to be wrapped to add custom functionality
        a new index searcher wrapping the provided index searcher or if no wrapping was performed the provided index searcher