diff options
Diffstat (limited to 'xapian')
-rw-r--r-- | xapian/xapian.scm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm index bd613a7..171203d 100644 --- a/xapian/xapian.scm +++ b/xapian/xapian.scm @@ -82,14 +82,21 @@ in-memory database would always remain empty and is of little use." (define* (make-document #:key data (terms '()) (values '())) (let ((doc (new-Document))) (when data - (Document-set-data doc data)) + (cond + ((string? data) + (Document-set-data doc data)) + ((bytevector? data) + (Document-set-data-bytes doc data)) + (else (error "Invalid document data" data)))) (for-each (match-lambda ((term . wdf-increment) (Document-add-term doc term wdf-increment))) terms) (for-each (match-lambda - ((slot . value) - (Document-add-value doc slot value))) + ((slot . (? string? value)) + (Document-add-value doc slot value)) + ((slot . (? bytevector? value)) + (Document-add-value-bytes doc slot value))) values) doc)) |