summaryrefslogtreecommitdiff
path: root/xapian
diff options
context:
space:
mode:
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)