Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/Versioning.luan @ 629:35dde32c02ab 0.15
change String.matches()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Jan 2016 23:07:52 -0700 |
parents | 22bfd8a2eaee |
children | ca169567ce07 |
comparison
equal
deleted
inserted
replaced
628:6510de302f95 | 629:35dde32c02ab |
---|---|
37 function M.a_big_step(db) | 37 function M.a_big_step(db) |
38 db.indexed_fields["id index"] = Lucene.type.string | 38 db.indexed_fields["id index"] = Lucene.type.string |
39 db.advanced_search( Lucene.literal"id index" .. ":*", function(_,doc_fn) | 39 db.advanced_search( Lucene.literal"id index" .. ":*", function(_,doc_fn) |
40 local doc = doc_fn() | 40 local doc = doc_fn() |
41 for field, value in pairs(copy(doc)) do | 41 for field, value in pairs(copy(doc)) do |
42 if matches(field,".* index") then | 42 if matches(field," index$") then |
43 local new_field = sub(field,1,-7) | 43 local new_field = sub(field,1,-7) |
44 db.indexed_fields[new_field] or error("field '"..new_field.."' not indexed") | 44 db.indexed_fields[new_field] or error("field '"..new_field.."' not indexed") |
45 doc[new_field] = value | 45 doc[new_field] = value |
46 doc[field] = nil | 46 doc[field] = nil |
47 end | 47 end |