summaryrefslogtreecommitdiff
path: root/xapian
diff options
context:
space:
mode:
Diffstat (limited to 'xapian')
-rw-r--r--xapian/xapian.scm24
1 files changed, 18 insertions, 6 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index 39461fc..75924ae 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -92,10 +92,8 @@ in-memory database would always remain empty and is of little use."
(Document-add-term doc term wdf-increment)))
terms)
(for-each (match-lambda
- ((slot . (? string? value))
- (Document-add-value doc slot value))
- ((slot . (? bytevector? value))
- (Document-add-value-bytes doc slot value)))
+ ((slot . value)
+ (document-slot-set! doc slot value)))
values)
doc))
@@ -119,8 +117,22 @@ in-memory database would always remain empty and is of little use."
(define document-slot-ref Document-get-value)
(define document-slot-ref-bytes Document-get-value-bytes)
-(define document-slot-set! Document-add-value)
-(define document-slot-set-bytes! Document-add-value-bytes)
+
+(define (document-slot-set! document slot value)
+ "Set SLOT of DOCUMENT to VALUE. VALUE may be a string or a
+bytevector."
+ (cond
+ ((string? value)
+ (Document-add-value document slot value))
+ ((bytevector? value)
+ (Document-add-value-bytes document slot value))
+ (else
+ (error "Invalid document slot value" value))))
+
+(define (document-slot-set-bytes! document slot value)
+ (display "document-slot-set-bytes! is deprecated. document-slot-set! now supports setting bytevectors as slot value. Please use that instead."
+ (current-error-port))
+ (Document-add-value-bytes document slot value))
(define make-stem new-Stem)