Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1537:f7649ad6e3e7 | 1538:634f6765830e |
---|---|
32 double = NumberFieldParser.DOUBLE | 32 double = NumberFieldParser.DOUBLE |
33 } | 33 } |
34 | 34 |
35 Lucene.quote = GoodQueryParser.quote | 35 Lucene.quote = GoodQueryParser.quote |
36 | 36 |
37 local function get_file(f,name) | |
38 type(f)=="table" or error(name.." must be table") | |
39 f.to_uri_string and matches(f.to_uri_string(),"^file:") or error(name.." must be file") | |
40 return f.java.file or error() | |
41 end | |
42 | |
37 function Lucene.index(index_dir,options) | 43 function Lucene.index(index_dir,options) |
38 type(index_dir)=="table" or error "index_dir must be table" | |
39 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" | |
40 options = options or {} | |
41 local index = {} | 44 local index = {} |
42 index.dir = index_dir | 45 index.dir = index_dir |
43 local java_index = LuceneIndex.getLuceneIndex(index_dir.java.file,options) | 46 index_dir = get_file(index_dir) |
47 options = options or {} | |
48 options.log_dir = options.log_dir and get_file(options.log_dir) | |
49 local java_index = LuceneIndex.getLuceneIndex(index_dir,options) | |
44 index.java = java_index | 50 index.java = java_index |
45 | 51 |
46 index.indexed_fields = {} | 52 index.indexed_fields = {} |
47 local mt = {} | 53 local mt = {} |
48 set_metatable(index.indexed_fields,mt) | 54 set_metatable(index.indexed_fields,mt) |
66 index.ensure_open = java_index.ensure_open | 72 index.ensure_open = java_index.ensure_open |
67 index.next_id = java_index.nextId | 73 index.next_id = java_index.nextId |
68 index.highlighter = java_index.highlighter | 74 index.highlighter = java_index.highlighter |
69 index.count_tokens = java_index.count_tokens | 75 index.count_tokens = java_index.count_tokens |
70 --index.close = java_index.close | 76 --index.close = java_index.close |
77 | |
78 index.rebuild_log = java_index.rebuild_log | |
71 | 79 |
72 index.has_postgres_backup = java_index.hasPostgresBackup() | 80 index.has_postgres_backup = java_index.hasPostgresBackup() |
73 index.rebuild_postgres_backup = java_index.rebuild_postgres_backup | 81 index.rebuild_postgres_backup = java_index.rebuild_postgres_backup |
74 index.restore_from_postgres = java_index.restore_from_postgres | 82 index.restore_from_postgres = java_index.restore_from_postgres |
75 index.force_restore_from_postgres = java_index.force_restore_from_postgres | 83 index.force_restore_from_postgres = java_index.force_restore_from_postgres |