Mercurial Hosting > luan
comparison src/luan/modules/lucene/Versioning.luan @ 1422:e48290f3d9fb
better quoting
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 17 Nov 2019 16:28:51 -0700 |
parents | 87a3738d7cc5 |
children |
comparison
equal
deleted
inserted
replaced
1421:8ab2f0fc3829 | 1422:e48290f3d9fb |
---|---|
33 | 33 |
34 | 34 |
35 -- hack to deal with latest changes | 35 -- hack to deal with latest changes |
36 function Versioning.a_big_step(db) | 36 function Versioning.a_big_step(db) |
37 db.indexed_fields["id index"] = Lucene.type.string | 37 db.indexed_fields["id index"] = Lucene.type.string |
38 db.advanced_search( Lucene.literal"id index" .. ":*", function(_,doc_fn) | 38 db.advanced_search( Lucene.quote"id index" .. ":*", function(_,doc_fn) |
39 local doc = doc_fn() | 39 local doc = doc_fn() |
40 for field, value in pairs(copy(doc)) do | 40 for field, value in pairs(copy(doc)) do |
41 if matches(field," index$") then | 41 if matches(field," index$") then |
42 local new_field = sub(field,1,-7) | 42 local new_field = sub(field,1,-7) |
43 db.indexed_fields[new_field] or error("field '"..new_field.."' not indexed") | 43 db.indexed_fields[new_field] or error("field '"..new_field.."' not indexed") |
47 end | 47 end |
48 doc.id = long(string_to_number(doc.id)) | 48 doc.id = long(string_to_number(doc.id)) |
49 db.save(doc) | 49 db.save(doc) |
50 end ) | 50 end ) |
51 db.indexed_fields["type index"] = Lucene.type.string | 51 db.indexed_fields["type index"] = Lucene.type.string |
52 db.delete( Lucene.literal"type index" .. ":*" ) | 52 db.delete( Lucene.quote"type index" .. ":*" ) |
53 end | 53 end |
54 | 54 |
55 return Versioning | 55 return Versioning |