1 17 package org.alfresco.repo.search.impl.lucene; 18 19 import java.io.IOException ; 20 21 import org.apache.lucene.index.IndexReader; 22 import org.apache.lucene.search.IndexSearcher; 23 import org.apache.lucene.store.Directory; 24 25 public class ClosingIndexSearcher extends IndexSearcher 26 { 27 IndexReader reader; 28 29 public ClosingIndexSearcher(String path) throws IOException 30 { 31 super(path); 32 } 33 34 public ClosingIndexSearcher(Directory directory) throws IOException 35 { 36 super(directory); 37 } 38 39 public ClosingIndexSearcher(IndexReader r) 40 { 41 super(r); 42 this.reader = r; 43 } 44 45 @Override 46 public void close() throws IOException 47 { 48 super.close(); 49 if(reader != null) 50 { 51 reader.close(); 52 } 53 } 54 55 } 56 | Popular Tags |