annotate src/lib/Db.luan @ 60:8b5b1bce7d6b

bcode menus
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 30 Nov 2022 23:50:52 -0700
parents 7ce54f6d93f2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
15
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
3 local new_error = Luan.new_error or error()
2
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Lucene = require "luan:lucene/Lucene.luan"
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Io = require "luan:Io.luan"
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local uri = Io.uri or error()
15
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
7 local Logging = require "luan:logging/Logging.luan"
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
8 local logger = Logging.logger "Db"
2
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local dir = uri("site:/private/local/lucene")
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 local Db = Lucene.index( dir, {} )
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
15 Db.indexed_fields.user_email = Lucene.type.lowercase
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
16 Db.indexed_fields.user_name = Lucene.type.lowercase
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
17
56
7ce54f6d93f2 add change name
Franklin Schmidt <fschmidt@gmail.com>
parents: 15
diff changeset
18 Db.indexed_fields.post_author_id = Lucene.type.long
8
be36282b556a add new_thread
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
19 Db.indexed_fields.post_is_root = Lucene.type.string
be36282b556a add new_thread
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
20 Db.indexed_fields.post_root_id = Lucene.type.long
be36282b556a add new_thread
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
21
15
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
22 function Db.not_in_transaction()
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
23 logger.error(new_error("not in transaction"))
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
24 end
0edde02b908c edit in place
Franklin Schmidt <fschmidt@gmail.com>
parents: 10
diff changeset
25
2
fc2383eb48a9 set config
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 return Db