view examples/blog/src/lib/Db.luan @ 1391:94f48cc76de8

add lucene check
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 05 Sep 2019 01:29:57 -0600
parents 2024d23ddd64
children 002152af497a
line wrap: on
line source

local Lucene = require "luan:lucene/Lucene.luan"
local Io = require "luan:Io.luan"


local Db = {}

local function completer(doc)
	return doc
end

function Db.new(lucene_dir)
	local dir = Io.uri(lucene_dir)
	local db = Lucene.index( dir, Lucene.type.english, {"subject","content"}, completer )
	
--	this is how you index a field
--	db.indexed_fields.post_date = Lucene.type.long

	return db
end

Db.db = Db.new("site:/private/local/lucene")

--Db.db.restore_from_postgres()
Db.db.check()
return Db