summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-03-06 21:21:02 +0530
committerArun Isaac2020-03-06 21:23:57 +0530
commit2aa0512c5fcea9b28895bfcfd2558645749512a0 (patch)
tree7059c86c07a61450ca0297372ee69686b35a6e60
parentede26b808188eb4d14c6b4181c933dfc09c0a22e (diff)
downloadguile-xapian-2aa0512c5fcea9b28895bfcfd2558645749512a0.tar.gz
guile-xapian-2aa0512c5fcea9b28895bfcfd2558645749512a0.tar.lz
guile-xapian-2aa0512c5fcea9b28895bfcfd2558645749512a0.zip
xapian: Wrap document values.
* xapian/xapian.scm (make-document): Support setting document values. (document-ref): New function.
-rw-r--r--xapian/xapian.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index 2ddc8b4..577791b 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -32,6 +32,7 @@
replace-document!
make-document
document-data
+ document-ref
make-stem
make-term-generator
index-text!
@@ -64,7 +65,7 @@
(define add-document! WritableDatabase-add-document)
(define replace-document! WritableDatabase-replace-document)
-(define* (make-document #:key data (terms '()))
+(define* (make-document #:key data (terms '()) (values '()))
(let ((doc (new-Document)))
(when data
(Document-set-data doc data))
@@ -72,9 +73,14 @@
((term . wdf-increment)
(Document-add-term doc term wdf-increment)))
terms)
+ (for-each (match-lambda
+ ((slot . value)
+ (Document-add-value doc slot value)))
+ values)
doc))
(define document-data Document-get-data)
+(define document-ref Document-get-value)
(define make-stem new-Stem)