diff src/luan/modules/lucene/Lucene.luan @ 1538:634f6765830e

use goodjava/lucene/logging
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 07 Aug 2020 21:42:16 -0600
parents e73b72a510b4
children c27dc6af87ca
line wrap: on
line diff
--- a/src/luan/modules/lucene/Lucene.luan	Fri Aug 07 13:38:25 2020 -0600
+++ b/src/luan/modules/lucene/Lucene.luan	Fri Aug 07 21:42:16 2020 -0600
@@ -34,13 +34,19 @@
 
 Lucene.quote = GoodQueryParser.quote
 
+local function get_file(f,name)
+	type(f)=="table" or error(name.." must be table")
+	f.to_uri_string and matches(f.to_uri_string(),"^file:") or error(name.." must be file")
+	return f.java.file or error()
+end
+
 function Lucene.index(index_dir,options)
-	type(index_dir)=="table" or error "index_dir must be table"
-	index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file"
-	options = options or {}
 	local index = {}
 	index.dir = index_dir
-	local java_index = LuceneIndex.getLuceneIndex(index_dir.java.file,options)
+	index_dir = get_file(index_dir)
+	options = options or {}
+	options.log_dir = options.log_dir and get_file(options.log_dir)
+	local java_index = LuceneIndex.getLuceneIndex(index_dir,options)
 	index.java = java_index
 
 	index.indexed_fields = {}
@@ -69,6 +75,8 @@
 	index.count_tokens = java_index.count_tokens
 	--index.close = java_index.close
 
+	index.rebuild_log = java_index.rebuild_log
+
 	index.has_postgres_backup = java_index.hasPostgresBackup()
 	index.rebuild_postgres_backup = java_index.rebuild_postgres_backup
 	index.restore_from_postgres = java_index.restore_from_postgres