diff options
author | Arun Isaac | 2021-09-06 00:11:15 +0530 |
---|---|---|
committer | Arun Isaac | 2021-09-06 00:11:15 +0530 |
commit | 22c8e5d33d17f54496d5e44c98a024c46155eb5b (patch) | |
tree | f968a80f4087c73f2d82d8ce18fe0dae573579b7 | |
parent | afdb348ba0866883c894c2f7ee29912f178e2c09 (diff) | |
download | guile-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.
-rw-r--r-- | xapian/xapian.scm | 8 |
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) |