diff examples/blog/src/lib/Db.luan @ 1672:8dd8c556c449

backup work
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 26 May 2022 21:10:02 -0600
parents 13135e289b50
children 2958cf04d844
line wrap: on
line diff
--- a/examples/blog/src/lib/Db.luan	Thu May 12 10:56:45 2022 -0600
+++ b/examples/blog/src/lib/Db.luan	Thu May 26 21:10:02 2022 -0600
@@ -3,27 +3,36 @@
 local stringify = Luan.stringify or error()
 local Lucene = require "luan:lucene/Lucene.luan"
 local Io = require "luan:Io.luan"
-local Hosted = require "luan:host/Hosted.luan"
+local uri = Io.uri or error()
 local Time = require "luan:Time.luan"
 local Thread = require "luan:Thread.luan"
+local Hosted = require "luan:host/Hosted.luan"
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "Db"
 
 
-local postgres_spec = Hosted.postgres_spec()
+if not Hosted.is_hosted then
+	require "java"
+	local BackupIndexWriter = require "java:goodjava.lucene.backup.BackupIndexWriter"
+	BackupIndexWriter.backupDomains = {"localhost"}
+end
+
+--local postgres_spec = Hosted.postgres_spec()
 --logger.info(stringify(postgres_spec))
 
-local dir = Io.uri("site:/private/local/lucene")
+local dir = uri("site:/private/local/lucene")
 local Db = Lucene.index( dir, {
 	default_type = Lucene.type.english
 	default_fields = {"subject","content"}
-	postgres_spec = postgres_spec
+	--postgres_spec = postgres_spec
+	log_dir = uri("site:/private/local/lucene_log")
 } )
 
 --	this is how you index a field
 --	db.indexed_fields.post_date = Lucene.type.long
 
-Db.restore_from_postgres()
+--Db.restore_from_postgres()
+Db.restore_from_log()
 Db.update{
 	[1] = function()
 		logger.info "update"