diff examples/blog/src/lib/Db.luan @ 1395:9dfff82dfc59

finish postgres work
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 09 Sep 2019 01:22:23 -0600
parents cc0dbca576dc
children a5f61890ad84
line wrap: on
line diff
--- a/examples/blog/src/lib/Db.luan	Sun Sep 08 22:13:08 2019 -0600
+++ b/examples/blog/src/lib/Db.luan	Mon Sep 09 01:22:23 2019 -0600
@@ -8,15 +8,19 @@
 local Db = {}
 
 local postgres_spec = Hosting.postgres_spec and Hosting.postgres_spec()
-if postgres_spec ~= nil then
-	function postgres_spec.completer(doc)
-		return doc
-	end
+
+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"}, postgres_spec )
+	local db = Lucene.index( dir, {
+		default_type = Lucene.type.english
+		default_fields = {"subject","content"}
+		completer = completer
+		postgres_spec = postgres_spec
+	} )
 	
 --	this is how you index a field
 --	db.indexed_fields.post_date = Lucene.type.long