From 0d735dcd5ac3343e8289fa1a4be6b87b88a3e816 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 15 Jul 2011 14:21:11 +0000 Subject: [PATCH] make IndexSearcher implement Closeable for consistency & IOUtils git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1147162 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/src/java/org/apache/lucene/search/IndexSearcher.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lucene/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/src/java/org/apache/lucene/search/IndexSearcher.java index 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 IndexSearcher instance; * use your own (non-Lucene) objects instead.

*/ -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. */ + @Override public void close() throws IOException { if (closeReader) { reader.close();