changeset 709:96a280ca32a2

add Lucene.instances
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 18 May 2016 19:55:48 -0600
parents 77e0c859c8a3
children 63cda9eec9a0
files lucene/src/luan/modules/lucene/Lucene.luan
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Wed May 18 18:11:00 2016 -0600
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Wed May 18 19:55:48 2016 -0600
@@ -17,6 +17,8 @@
 
 local M = {}
 
+M.instances = {}
+
 M.type = {
 	string = LuceneIndex.STRING_FIELD_PARSER;
 	integer = NumberFieldParser.INT;
@@ -46,11 +48,18 @@
 	index.delete = java_index.delete
 	index.save = java_index.save
 	index.update_in_transaction = java_index.update_in_transaction
-	index.close = java_index.close
+--	index.close = java_index.close
 	index.ensure_open = java_index.ensure_open
 	index.next_id = java_index.nextId
 	index.highlighter = java_index.highlighter
 
+	M.instances[index] = true
+
+	function index.close()
+		M.instances[index] = nil
+		java_index.close()
+	end
+
 	function index.search(query, from, to, sort)
 		local results = {}
 		local function fn(i,doc_fn)