comparison examples/blog/src/lib/Db.luan @ 1220:4721c482c86b

cleaner Db example
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 21 Mar 2018 15:54:57 -0600
parents examples/blog/src/lib/Db_mod.luan@bae2d0c2576c
children 4416b9cbebf9
comparison
equal deleted inserted replaced
1219:b602badc876b 1220:4721c482c86b
1 return require "site:/lib/Db_mod.luan".new_db() 1 local Lucene = require "luan:lucene/Lucene.luan"
2 local Io = require "luan:Io.luan"
3
4
5 local Db = {}
6
7 function Db.new_db(lucene_dir)
8 local dir = Io.uri(lucene_dir).to_string()
9 local db = Lucene.index( dir, Lucene.type.english, {"subject","content"} )
10
11 -- this is how you index a field
12 -- db.indexed_fields.post_date = Lucene.type.long
13
14 return db
15 end
16
17 Db.db = Db.new_db("site:/private/local/lucene")
18
19 return Db