Apache Solr open-source search software
make IndexSearcher implement Closeable for consistency & IOUtils
Simon Willnauer0d735dcd5ac3
diff --git a/lucene/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/src/java/org/apache/lucene/search/IndexSearcher.javaindex 81b90f28679..a50d7713978 100644--- a/lucene/src/java/org/apache/lucene/search/IndexSearcher.java+++ b/lucene/src/java/org/apache/lucene/search/IndexSearcher.java@@ -17,6 +17,7 @@ package org.apache.lucene.search;* limitations under the License.*/+import java.io.Closeable;import java.io.IOException;import java.util.Iterator;import java.util.NoSuchElementException;@@ -67,7 +68,7 @@ import org.apache.lucene.util.ThreadInterruptedException;* synchronize on the <code>IndexSearcher</code> instance;* use your own (non-Lucene) objects instead.</p>*/-public class IndexSearcher {+public class IndexSearcher implements Closeable {final IndexReader reader; // package private for testing!private boolean closeReader;@@ -265,6 +266,7 @@ public class IndexSearcher {* If the IndexReader was supplied implicitly by specifying a directory, then* the IndexReader is closed.*/+ @Overridepublic void close() throws IOException {if (closeReader) {reader.close();