Mercurial Hosting > shareasale
view src/lib/Db.luan @ 2:81c73ce6541c default tip
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 20 Sep 2022 20:19:52 -0600 |
parents | bd2abcd7190a |
children |
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 Table = require "luan:Table.luan" local concat = Table.concat or error() local Lucene = require "luan:lucene/Lucene.luan" local Shared = require "site:/lib/Shared.luan" local to_list = Shared.to_list or error() local function supplementer(doc) local t = {} t[#t+1] = doc.user_name if doc.category ~= nil then t[#t+1] = concat(to_list(doc.category)," ") end t[#t+1] = doc.description return { free = concat(t," ") } end local dir = uri("site:/lucene") local options = { supplementer = supplementer default_type = Lucene.type.english default_fields = {"free"} } local Db = Lucene.index(dir,options) Db.indexed_fields.free = Lucene.type.english Db.indexed_fields.user_id = Lucene.type.string Db.indexed_fields.user_name = Lucene.type.english Db.indexed_fields.category = Lucene.type.english Db.indexed_fields.description = Lucene.type.english return Db