diff options
-rw-r--r-- | tissue/search.scm | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tissue/search.scm b/tissue/search.scm index 5ac5af0..8dac645 100644 --- a/tissue/search.scm +++ b/tissue/search.scm @@ -110,20 +110,21 @@ first call. OFFSET specifies the number of items to ignore at the beginning of the result set. MAXIMUM-ITEMS specifies the maximum number of items to return." - (mset-fold (lambda (item result) - (proc (call-with-input-string (document-data (mset-item-document item)) - (compose scm->object read)) - (MSetIterator-mset-get item) - result)) - initial - (enquire-mset (let* ((query (parse-query search-query)) - (enquire (enquire db query))) - ;; Sort by recency date (slot 0) when - ;; query is strictly boolean. - (when (boolean-query? query) - (Enquire-set-sort-by-value enquire 0 #t)) - enquire) - #:maximum-items maximum-items))) + (let ((mset (enquire-mset (let* ((query (parse-query search-query)) + (enquire (enquire db query))) + ;; Sort by recency date (slot 0) when + ;; query is strictly boolean. + (when (boolean-query? query) + (Enquire-set-sort-by-value enquire 0 #t)) + enquire) + #:maximum-items maximum-items))) + (mset-fold (lambda (item result) + (proc (call-with-input-string (document-data (mset-item-document item)) + (compose scm->object read)) + mset + result)) + initial + mset))) (define* (search-map proc db search-query #:key (offset 0) (maximum-items (database-document-count db))) |