Mercurial Hosting > luan
comparison src/luan/modules/lucene/Lucene.luan @ 1397:0dc9837c16be
fix lucene issues
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 11 Sep 2019 01:31:21 -0600 |
parents | 9dfff82dfc59 |
children | 67c0e47b5be3 |
comparison
equal
deleted
inserted
replaced
1396:a5f61890ad84 | 1397:0dc9837c16be |
---|---|
39 | 39 |
40 function Lucene.index(index_dir,options) | 40 function Lucene.index(index_dir,options) |
41 type(index_dir)=="table" or error "index_dir must be table" | 41 type(index_dir)=="table" or error "index_dir must be table" |
42 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" | 42 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" |
43 options = options or {} | 43 options = options or {} |
44 options.postgres_spec==nil or type(options.postgres_spec)=="table" or error "postgres_spec must be table" | |
45 options.completer==nil or type(options.completer)=="function" or error "completer must be table" | |
46 local index = {} | 44 local index = {} |
47 index.dir = index_dir | 45 index.dir = index_dir |
48 local java_index, closer = LuceneIndex.getLuceneIndex(index_dir.java.file,options.default_type,options.default_fields,options.completer,options.postgres_spec) | 46 local java_index = LuceneIndex.getLuceneIndex(index_dir.java.file,options) |
49 index.java = java_index | 47 index.java = java_index |
50 index.closer = closer or error() | |
51 index.completer = options.completer | 48 index.completer = options.completer |
52 | 49 |
53 index.indexed_fields = {} | 50 index.indexed_fields = {} |
54 local mt = {} | 51 local mt = {} |
55 set_metatable(index.indexed_fields,mt) | 52 set_metatable(index.indexed_fields,mt) |
71 index.ensure_open = java_index.ensure_open | 68 index.ensure_open = java_index.ensure_open |
72 index.next_id = java_index.nextId | 69 index.next_id = java_index.nextId |
73 index.highlighter = java_index.highlighter | 70 index.highlighter = java_index.highlighter |
74 index.indexed_only_fields = java_index.indexed_only_fields | 71 index.indexed_only_fields = java_index.indexed_only_fields |
75 index.count_tokens = java_index.count_tokens | 72 index.count_tokens = java_index.count_tokens |
76 index.close = closer.close | 73 index.close = java_index.close |
77 | 74 |
78 index.has_postgres_backup = java_index.hasPostgresBackup() | 75 index.has_postgres_backup = java_index.hasPostgresBackup() |
79 function index.rebuild_postgres_backup() | 76 function index.rebuild_postgres_backup() |
80 java_index.rebuild_postgres_backup(index.completer) | 77 java_index.rebuild_postgres_backup(index.completer) |
81 end | 78 end |
82 index.restore_from_postgres = java_index.restore_from_postgres | 79 index.restore_from_postgres = java_index.restore_from_postgres |
80 index.force_restore_from_postgres = java_index.force_restore_from_postgres | |
83 function index.check() | 81 function index.check() |
84 java_index.check(index.completer) | 82 java_index.check(index.completer) |
85 end | 83 end |
86 | 84 |
87 function index.search( query, from, to, options ) | 85 function index.search( query, from, to, options ) |