Mercurial Hosting > luan
annotate examples/blog/src/lib/Db.luan @ 1367:836e00bf7ce2
add Lucene backup_to
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 18 Jun 2019 16:27:03 -0600 |
parents | 4416b9cbebf9 |
children | 709f7498a363 |
rev | line source |
---|---|
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
599
diff
changeset
|
1 local Lucene = require "luan:lucene/Lucene.luan" |
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
599
diff
changeset
|
2 local Io = require "luan:Io.luan" |
596 | 3 |
4 | |
1220 | 5 local Db = {} |
596 | 6 |
1224 | 7 function Db.new(lucene_dir) |
1220 | 8 local dir = Io.uri(lucene_dir).to_string() |
599
50540f0813e2
support default search fields in lucene;
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
9 local db = Lucene.index( dir, Lucene.type.english, {"subject","content"} ) |
596 | 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 | |
1224 | 17 Db.db = Db.new("site:/private/local/lucene") |
1220 | 18 |
19 return Db |