Mercurial Hosting > luan
annotate examples/blog/src/lib/Db_mod.luan @ 1168:312e4cadd508
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 08 Feb 2018 19:17:57 -0700 |
parents | bae2d0c2576c |
children |
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 | |
1088
bae2d0c2576c
change module naming convention
Franklin Schmidt <fschmidt@gmail.com>
parents:
779
diff
changeset
|
5 local Db_mod = {} |
596 | 6 |
1088
bae2d0c2576c
change module naming convention
Franklin Schmidt <fschmidt@gmail.com>
parents:
779
diff
changeset
|
7 Db_mod.lucene_dir = "site:/private/local/lucene" |
596 | 8 |
1088
bae2d0c2576c
change module naming convention
Franklin Schmidt <fschmidt@gmail.com>
parents:
779
diff
changeset
|
9 function Db_mod.new_db() |
bae2d0c2576c
change module naming convention
Franklin Schmidt <fschmidt@gmail.com>
parents:
779
diff
changeset
|
10 local dir = Io.uri(Db_mod.lucene_dir).to_string() |
599
50540f0813e2
support default search fields in lucene;
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
11 local db = Lucene.index( dir, Lucene.type.english, {"subject","content"} ) |
596 | 12 |
13 -- this is how you index a field | |
14 -- db.indexed_fields.post_date = Lucene.type.long | |
15 | |
16 return db | |
17 end | |
18 | |
1088
bae2d0c2576c
change module naming convention
Franklin Schmidt <fschmidt@gmail.com>
parents:
779
diff
changeset
|
19 return Db_mod |