Mercurial Hosting > luan
comparison src/luan/modules/lucene/Lucene.luan @ 1453:928be2a4d565
fix postgres backup
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 15:09:10 -0700 |
parents | f3a417074cea |
children | a84ce37f3892 |
comparison
equal
deleted
inserted
replaced
1452:c15444f4da05 | 1453:928be2a4d565 |
---|---|
37 type(index_dir)=="table" or error "index_dir must be table" | 37 type(index_dir)=="table" or error "index_dir must be table" |
38 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" | 38 index_dir.to_uri_string and matches(index_dir.to_uri_string(),"^file:") or error "must be file" |
39 options = options or {} | 39 options = options or {} |
40 local index = {} | 40 local index = {} |
41 index.dir = index_dir | 41 index.dir = index_dir |
42 index.completer = options.completer | |
43 options.completer = nil | |
42 local java_index = LuceneIndex.getLuceneIndex(index_dir.java.file,options) | 44 local java_index = LuceneIndex.getLuceneIndex(index_dir.java.file,options) |
43 index.java = java_index | 45 index.java = java_index |
44 index.completer = options.completer | |
45 | 46 |
46 index.indexed_fields = {} | 47 index.indexed_fields = {} |
47 local mt = {} | 48 local mt = {} |
48 set_metatable(index.indexed_fields,mt) | 49 set_metatable(index.indexed_fields,mt) |
49 function mt.__index(_,key) | 50 function mt.__index(_,key) |
57 index.snapshot = java_index.snapshot | 58 index.snapshot = java_index.snapshot |
58 index.advanced_search = java_index.advanced_search | 59 index.advanced_search = java_index.advanced_search |
59 index.search_in_transaction = java_index.search_in_transaction | 60 index.search_in_transaction = java_index.search_in_transaction |
60 index.delete_all = java_index.delete_all | 61 index.delete_all = java_index.delete_all |
61 index.delete = java_index.delete | 62 index.delete = java_index.delete |
62 index.save = java_index.save | 63 --index.save = java_index.save |
63 index.run_in_transaction = java_index.run_in_transaction | 64 index.run_in_transaction = java_index.run_in_transaction |
64 index.ensure_open = java_index.ensure_open | 65 index.ensure_open = java_index.ensure_open |
65 index.next_id = java_index.nextId | 66 index.next_id = java_index.nextId |
66 index.highlighter = java_index.highlighter | 67 index.highlighter = java_index.highlighter |
67 index.indexed_only_fields = java_index.indexed_only_fields | 68 index.indexed_only_fields = java_index.indexed_only_fields |
68 index.count_tokens = java_index.count_tokens | 69 index.count_tokens = java_index.count_tokens |
69 --index.close = java_index.close | 70 --index.close = java_index.close |
70 | 71 |
72 local java_save = java_index.save | |
73 function index.save(doc,boosts) | |
74 java_save(index.completer,doc,boosts) | |
75 end | |
76 | |
71 index.has_postgres_backup = java_index.hasPostgresBackup() | 77 index.has_postgres_backup = java_index.hasPostgresBackup() |
72 function index.rebuild_postgres_backup() | 78 index.rebuild_postgres_backup = java_index.rebuild_postgres_backup |
73 java_index.rebuild_postgres_backup(index.completer) | 79 function index.restore_from_postgres() |
74 end | 80 java_index.restore_from_postgres(index.completer) |
75 index.restore_from_postgres = java_index.restore_from_postgres | 81 end |
76 index.force_restore_from_postgres = java_index.force_restore_from_postgres | 82 function index.force_restore_from_postgres() |
77 function index.check() | 83 java_index.force_restore_from_postgres(index.completer) |
78 java_index.check(index.completer) | 84 end |
79 end | 85 index.check = java_index.check |
80 | 86 |
81 function index.search( query, from, to, options ) | 87 function index.search( query, from, to, options ) |
82 from or error "missing 'from' parameter" | 88 from or error "missing 'from' parameter" |
83 to or error "missing 'to' parameter" | 89 to or error "missing 'to' parameter" |
84 options = options or {} | 90 options = options or {} |