annotate blog/src/lib/Db_mod.luan @ 598:e930f92d0f61

add blog test
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 16 Sep 2015 14:32:52 -0600
parents 6bb0c83116e9
children 50540f0813e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
596
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Lucene = require "luan:lucene/Lucene"
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local Io = require "luan:Io"
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local M = {}
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 M.lucene_dir = "site:/private/local/lucene"
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 function M.new_db()
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local dir = Io.uri(M.lucene_dir).to_string()
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local db = Lucene.index(dir)
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 -- this is how you index a field
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 -- db.indexed_fields.post_date = Lucene.type.long
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 return db
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 end
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
6bb0c83116e9 add blog sample app
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 return M