From 22c8e5d33d17f54496d5e44c98a024c46155eb5b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 6 Sep 2021 00:11:15 +0530 Subject: xapian: Support in-memory databases. * xapian/xapian.scm (call-with-in-memory-database): New public function. --- xapian/xapian.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xapian/xapian.scm b/xapian/xapian.scm index 112e6c5..a0876d1 100644 --- a/xapian/xapian.scm +++ b/xapian/xapian.scm @@ -30,6 +30,7 @@ xapian-open-writable xapian-close-writable call-with-writable-database + call-with-in-memory-database add-document! replace-document! make-document @@ -66,6 +67,13 @@ (let ((db (xapian-open-writable dbpath))) (dynamic-wind noop (cut proc db) (cut xapian-close-writable db)))) +(define (call-with-in-memory-database proc) + "Call PROC passing it an in-memory writable database. Only a +writable in-memory database can be created, since a read-only +in-memory database would always remain empty and is of little use." + (let ((db (inmemory-open))) + (dynamic-wind noop (cut proc db) (cut xapian-close-writable db)))) + (define add-document! WritableDatabase-add-document) (define replace-document! WritableDatabase-replace-document) -- cgit v1.2.3