Mercurial Hosting > luan
comparison src/luan/modules/lucene/Lucene.luan @ 1387:bc40bc9aab3a
start postgres backup
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 02 Sep 2019 22:23:12 -0600 |
parents | 87a3738d7cc5 |
children | 2024d23ddd64 |
comparison
equal
deleted
inserted
replaced
1386:dc36dd8bf839 | 1387:bc40bc9aab3a |
---|---|
33 double = NumberFieldParser.DOUBLE | 33 double = NumberFieldParser.DOUBLE |
34 } | 34 } |
35 | 35 |
36 Lucene.literal = SaneQueryParser.literal | 36 Lucene.literal = SaneQueryParser.literal |
37 | 37 |
38 function Lucene.index(index_dir,default_type,default_fields) | 38 function Lucene.index(index_dir,default_type,default_fields,postgres_backup) |
39 type(index_dir)=="table" or error "index_dir must be table" | 39 type(index_dir)=="table" or error "index_dir must be table" |
40 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" | 40 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" |
41 local index = {} | 41 local index = {} |
42 index.dir = index_dir | 42 index.dir = index_dir |
43 local java_index, closer = LuceneIndex.getLuceneIndex(index_dir.java.file,default_type,default_fields) | 43 local java_index, closer = LuceneIndex.getLuceneIndex(index_dir.java.file,default_type,default_fields,postgres_backup) |
44 index.java = java_index | 44 index.java = java_index |
45 index.closer = closer or error() | 45 index.closer = closer or error() |
46 | 46 |
47 index.indexed_fields = {} | 47 index.indexed_fields = {} |
48 local mt = {} | 48 local mt = {} |
66 index.next_id = java_index.nextId | 66 index.next_id = java_index.nextId |
67 index.highlighter = java_index.highlighter | 67 index.highlighter = java_index.highlighter |
68 index.indexed_only_fields = java_index.indexed_only_fields | 68 index.indexed_only_fields = java_index.indexed_only_fields |
69 index.count_tokens = java_index.count_tokens | 69 index.count_tokens = java_index.count_tokens |
70 index.close = closer.close | 70 index.close = closer.close |
71 | |
72 index.has_postgres_backup = java_index.hasPostgresBackup() | |
73 index.rebuild_postgres_backup = java_index.rebuild_postgres_backup | |
71 | 74 |
72 function index.search( query, from, to, options ) | 75 function index.search( query, from, to, options ) |
73 from or error "missing 'from' parameter" | 76 from or error "missing 'from' parameter" |
74 to or error "missing 'to' parameter" | 77 to or error "missing 'to' parameter" |
75 options = options or {} | 78 options = options or {} |