aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-10-17 11:06:21 +0530
committerArun Isaac2020-10-17 11:08:01 +0530
commitf11f45ebeb1131c3a6af8dde374463fa63c0249b (patch)
tree8076c66d8193907551d33d6496fe0988bff27099
parent408557714585873a88ecf21ee36de7bce9b3f34d (diff)
downloadguile-xapian-f11f45ebeb1131c3a6af8dde374463fa63c0249b.tar.gz
guile-xapian-f11f45ebeb1131c3a6af8dde374463fa63c0249b.tar.lz
guile-xapian-f11f45ebeb1131c3a6af8dde374463fa63c0249b.zip
xapian: Introduce document-bytes.
* xapian/xapian.scm (document-bytes): New function.
-rw-r--r--xapian/xapian.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index 92bf5d3..112e6c5 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -19,6 +19,7 @@
(define-module (xapian xapian)
#:use-module (rnrs arithmetic bitwise)
+ #:use-module (rnrs bytevectors)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26)
#:use-module (xapian wrap)
@@ -33,6 +34,7 @@
replace-document!
make-document
document-data
+ document-bytes
document-slot-ref
make-stem
make-term-generator
@@ -84,6 +86,11 @@
(define document-data Document-get-data)
(define document-slot-ref Document-get-value)
+(define (document-bytes document)
+ "Return the data of DOCUMENT as a bytevector."
+ (u8-list->bytevector
+ (map char->integer (string->list (document-data document)))))
+
(define make-stem new-Stem)
(define* (make-term-generator #:key stem document)