summaryrefslogtreecommitdiff
path: root/xapian
diff options
context:
space:
mode:
authorArun Isaac2021-09-06 00:11:15 +0530
committerArun Isaac2021-09-06 00:11:15 +0530
commit22c8e5d33d17f54496d5e44c98a024c46155eb5b (patch)
treef968a80f4087c73f2d82d8ce18fe0dae573579b7 /xapian
parentafdb348ba0866883c894c2f7ee29912f178e2c09 (diff)
downloadguile-xapian-22c8e5d33d17f54496d5e44c98a024c46155eb5b.tar.gz
guile-xapian-22c8e5d33d17f54496d5e44c98a024c46155eb5b.tar.lz
guile-xapian-22c8e5d33d17f54496d5e44c98a024c46155eb5b.zip
xapian: Support in-memory databases.
* xapian/xapian.scm (call-with-in-memory-database): New public function.
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm8
1 files changed, 8 insertions, 0 deletions
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)