summaryrefslogtreecommitdiff
path: root/xapian/xapian.scm
diff options
context:
space:
mode:
authorBob1312021-09-02 07:33:42 +1000
committerArun Isaac2021-09-07 01:23:59 +0530
commitdc0e4ab5aeb76a0ec2d37267b49fd2348ef7c420 (patch)
tree3112b07737c810a00a8e5298e48b0c88eeff346d /xapian/xapian.scm
parent3e74ce5db678ab36178920a7d071b408e4ea2efe (diff)
downloadguile-xapian-dc0e4ab5aeb76a0ec2d37267b49fd2348ef7c420.tar.gz
guile-xapian-dc0e4ab5aeb76a0ec2d37267b49fd2348ef7c420.tar.lz
guile-xapian-dc0e4ab5aeb76a0ec2d37267b49fd2348ef7c420.zip
xapian: Reimplement document-bytes.
The current implementation of document-bytes involves converting the document data string into a list of characters, mapping over the result with char->integer and passing the list of integers to u8-list->integer. This is quite an expensive operation (relative to what the user might expect), and may not reliably return a result if the document data couldn't be decoded as a UTF-8 string in the first place. Now that we have SWIG wrappers that return bytevectors directly, we can redefine document-bytes as an alias of Document-get-data-bytes. * xapian/xapian.scm (document-bytes): Redefine function in terms of Document-get-data-bytes. Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
Diffstat (limited to 'xapian/xapian.scm')
-rw-r--r--xapian/xapian.scm6
1 files changed, 2 insertions, 4 deletions
diff --git a/xapian/xapian.scm b/xapian/xapian.scm
index a0876d1..0e2e966 100644
--- a/xapian/xapian.scm
+++ b/xapian/xapian.scm
@@ -1,5 +1,6 @@
;;; guile-xapian --- Guile bindings for Xapian
;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021 Bob131 <bob@bob131.so>
;;;
;;; This file is part of guile-xapian.
;;;
@@ -94,10 +95,7 @@ in-memory database would always remain empty and is of little use."
(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 document-bytes Document-get-data-bytes)
(define make-stem new-Stem)