view examples/blog/src/lib/Db.luan @ 1221:b99947af8b79

better path parsing
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 25 Mar 2018 17:13:11 -0600
parents 4721c482c86b
children 4416b9cbebf9
line wrap: on
line source

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


local Db = {}

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

	return db
end

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

return Db