comparison examples/blog/src/lib/Post.luan @ 1369:709f7498a363

change Lucene.index() and add Lucene.recover()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 19 Jun 2019 00:26:10 -0600
parents 4721c482c86b
children bc40bc9aab3a
comparison
equal deleted inserted replaced
1368:5225cd6ed478 1369:709f7498a363
44 local doc = db.get_document("id:"..id) 44 local doc = db.get_document("id:"..id)
45 return doc and from_doc(doc) 45 return doc and from_doc(doc)
46 end 46 end
47 47
48 function Post.get_all() 48 function Post.get_all()
49 local docs = db.search("type:post",1,1000,"id desc") 49 local docs = db.search("type:post",1,1000,{sort="id desc"})
50 local posts = {} 50 local posts = {}
51 for _, doc in ipairs(docs) do 51 for _, doc in ipairs(docs) do
52 posts[#posts+1] = from_doc(doc) 52 posts[#posts+1] = from_doc(doc)
53 end 53 end
54 return posts 54 return posts