aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-09 23:42:03 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-09 23:42:03 +0200
commit914d78fefc0e60cadd0857e88951ad17e42ccfb7 (patch)
tree655cdaba5b234c475d4f9b319db7dc806247378b
parentPartial search page works, but alway times out first. (diff)
downloadcalp-914d78fefc0e60cadd0857e88951ad17e42ccfb7.tar.gz
calp-914d78fefc0e60cadd0857e88951ad17e42ccfb7.tar.xz
Box approach to partial pages.
A partial (currently all) pages gets saved over with sub-streams limited to what was found during our timeframe. Works great for a trailing page, but fails for something which matches nothing (#f). Probably fails for all cases which ends on a page boundry.
-rw-r--r--module/srfi/srfi-41/util.scm2
-rw-r--r--module/vcomponent/search.scm8
2 files changed, 7 insertions, 3 deletions
diff --git a/module/srfi/srfi-41/util.scm b/module/srfi/srfi-41/util.scm
index 472170d7..a3f3890b 100644
--- a/module/srfi/srfi-41/util.scm
+++ b/module/srfi/srfi-41/util.scm
@@ -96,7 +96,7 @@
(if (stream-null? page)
stream-null
(stream-cons
- page
+ ((@ (srfi srfi-111) box) page)
(stream-paginate rest page-size))))))
(define*-public (stream-paginate stream optional: (page-size 10))
diff --git a/module/vcomponent/search.scm b/module/vcomponent/search.scm
index 65e2630a..708f0895 100644
--- a/module/vcomponent/search.scm
+++ b/module/vcomponent/search.scm
@@ -5,6 +5,7 @@
:use-module (srfi srfi-9)
:use-module (srfi srfi-41)
:use-module (srfi srfi-41 util)
+ :use-module (srfi srfi-111)
)
@@ -52,12 +53,15 @@
;; stream-force needs to happen within the actual
;; @var{call-with-time-limit}.
(lambda ()
- (let loop ((strm (stream-ref query page)))
+ (let loop ((strm (unbox (stream-ref query page))))
(if (stream-null? strm) lst
(set! lst (cons (stream-car strm) lst))
(loop (stream-cdr strm)))))
(lambda _ (format (current-error-port) "~a~%" 'timed-out)))
- (reverse lst)))
+ (let ((list (reverse lst)))
+ (set-box! (stream-ref query page)
+ (list->stream list))
+ list)))
;; Creates a prepared query wrappend in a paginator.