@@ -998,6 +998,11 @@ public final SearcherSupplier acquireSearcherSupplier(Function<Searcher, Searche
998998    // Called before a {@link Searcher} is created, to allow subclasses to perform any stats or logging operations. 
999999    protected  void  onSearcherCreation (String  source , SearcherScope  scope ) {}
10001000
1001+     // Allows subclasses to wrap the DirectoryReader before it is used to create Searchers 
1002+     protected  DirectoryReader  wrapDirectoryReader (DirectoryReader  reader ) throws  IOException  {
1003+         return  reader ;
1004+     }
1005+ 
10011006    /** 
10021007     * Acquires a point-in-time reader that can be used to create {@link Engine.Searcher}s on demand. 
10031008     */ 
@@ -1012,14 +1017,15 @@ public SearcherSupplier acquireSearcherSupplier(Function<Searcher, Searcher> wra
10121017        try  {
10131018            ReferenceManager <ElasticsearchDirectoryReader > referenceManager  = getReferenceManager (scope );
10141019            ElasticsearchDirectoryReader  acquire  = referenceManager .acquire ();
1020+             DirectoryReader  wrappedDirectoryReader  = wrapDirectoryReader (acquire );
10151021            SearcherSupplier  reader  = new  SearcherSupplier (wrapper ) {
10161022                @ Override 
10171023                public  Searcher  acquireSearcherInternal (String  source ) {
10181024                    assert  assertSearcherIsWarmedUp (source , scope );
10191025                    onSearcherCreation (source , scope );
10201026                    return  new  Searcher (
10211027                        source ,
1022-                         acquire ,
1028+                         wrappedDirectoryReader ,
10231029                        engineConfig .getSimilarity (),
10241030                        engineConfig .getQueryCache (),
10251031                        engineConfig .getQueryCachingPolicy (),
0 commit comments