Mercurial Hosting > luan
changeset 524:70bda9184158
minor fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 27 May 2015 03:20:01 -0600 |
parents | dcd278f02e67 |
children | dc39a2788894 |
files | lucene/src/luan/modules/lucene/LuceneIndex.java |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java Wed May 27 03:13:30 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneIndex.java Wed May 27 03:20:01 2015 -0600 @@ -48,6 +48,7 @@ private LuceneSearcher searcher; public final FieldTable fields = new FieldTable(); private boolean isClosed = false; + private final Runnable closer; public LuceneIndex(LuanState luan,String indexDirStr) throws LuanException, IOException { File indexDir = new File(indexDirStr); @@ -61,13 +62,14 @@ writer = new IndexWriter(dir,conf); writer.commit(); // commit index creation reader = DirectoryReader.open(dir); - luan.onClose(new Runnable(){public void run() { + closer = new Runnable(){public void run(){ try { close(); } catch(IOException e) { logger.error("",e); } - }}); + }}; + luan.onClose(closer); searcher = new LuceneSearcher(this,reader); initId(luan); }