@@ -326,7 +326,7 @@ private Collector buildAndRunCollectorChain(
326326
327327 try {
328328 try {
329- super . search (query , collector );
329+ search (query , collector );
330330 } finally {
331331 // The complete() method can use the collectors, so this needs to be surrounded by the same
332332 // catch logic that limit collecting
@@ -782,32 +782,33 @@ public QueryResult search(QueryResult qr, QueryCommand cmd) throws IOException {
782782 return qr ;
783783 }
784784
785- /*@Override
786- TBD . This is overridden to exit the query when limits are reached
787- protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector)
788- throws IOException {
785+ @ Override
786+ public void search (Query query , Collector collector ) throws IOException {
789787 QueryLimits queryLimits = QueryLimits .getCurrentLimits ();
790- if (EnvUtils.getPropertyAsBool(EXITABLE_READER_PROPERTY, Boolean.FALSE)
791- || !queryLimits.isLimitsEnabled()) {
788+ if (!queryLimits .isLimitsEnabled ()) {
792789 // no timeout. Pass through to super class
793- super.search(leaves, weight , collector);
790+ super .search (query , collector );
794791 } else {
795792 // Timeout enabled! This impl is maybe a hack. Use Lucene's IndexSearcher timeout.
796793 // But only some queries have it so don't use on "this" (SolrIndexSearcher), not to mention
797794 // that timedOut() might race with concurrent queries (dubious design).
798795 // So we need to make a new IndexSearcher instead of using "this".
799- new IndexSearcher(reader) { // cheap, actually!
796+ // Make sure to reuse the existing executor.
797+ new IndexSearcher (
798+ reader , core .getCoreContainer ().getIndexSearcherExecutor ()) { // cheap, actually!
800799 void searchWithTimeout () throws IOException {
801800 setTimeout (queryLimits ); // Lucene's method name is less than ideal here...
802- super.search(leaves, weight, collector); // FYI protected access
801+ // XXX Deprecated in Lucene 10, we should probably use search(Query, CollectorManager)
802+ // instead
803+ super .search (query , collector );
803804 if (timedOut ()) {
804805 throw new QueryLimitsExceededException (
805806 "Limits exceeded! (search): " + queryLimits .limitStatusMessage ());
806807 }
807808 }
808809 }.searchWithTimeout ();
809810 }
810- }*/
811+ }
811812
812813 /**
813814 * Retrieve the {@link Document} instance corresponding to the document id.
0 commit comments