Mercurial Hosting > lang
view src/lib/Db.luan @ 4:b1adec083e44
chat work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Jul 2025 22:15:41 -0600 |
parents | 78708fa556a0 |
children | 0c17c233c45a |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local uri = Io.uri or error() local Thread = require "luan:Thread.luan" local Time = require "luan:Time.luan" local Lucene = require "luan:lucene/Lucene.luan" local Http = require "luan:http/Http.luan" local dir = uri("site:/private/local/lucene") local Db = Lucene.index( dir, { log_dir = uri("site:/private/local/lucene_log") name = "lucene" version = 1 } ) Db.indexed_fields.user_email = Lucene.type.lowercase Db.indexed_fields.chat_user_id = Lucene.type.long Db.indexed_fields.chat_updated = Lucene.type.long Db.restore_from_log() if Http.is_serving then Thread.schedule( Db.check, { delay=0, repeating_delay=Time.period{hours=1} } ) end return Db