2
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
15
|
3 local new_error = Luan.new_error or error()
|
2
|
4 local Lucene = require "luan:lucene/Lucene.luan"
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local uri = Io.uri or error()
|
15
|
7 local Logging = require "luan:logging/Logging.luan"
|
|
8 local logger = Logging.logger "Db"
|
2
|
9
|
|
10
|
|
11 local dir = uri("site:/private/local/lucene")
|
|
12
|
|
13 local Db = Lucene.index( dir, {} )
|
|
14
|
3
|
15 Db.indexed_fields.user_email = Lucene.type.lowercase
|
|
16 Db.indexed_fields.user_name = Lucene.type.lowercase
|
|
17
|
56
|
18 Db.indexed_fields.post_author_id = Lucene.type.long
|
8
|
19 Db.indexed_fields.post_is_root = Lucene.type.string
|
|
20 Db.indexed_fields.post_root_id = Lucene.type.long
|
|
21
|
15
|
22 function Db.not_in_transaction()
|
|
23 logger.error(new_error("not in transaction"))
|
|
24 end
|
|
25
|
2
|
26 return Db
|