diff options
author | Arun Isaac | 2023-01-22 23:30:02 +0000 |
---|---|---|
committer | Arun Isaac | 2023-01-23 00:28:12 +0000 |
commit | 08afa8b0548b2870a36f1a30ba3c4dc7f515f169 (patch) | |
tree | c201904e17d9369106cd82a771bbeea3f8ff9fa2 | |
parent | a2045cbf478b7cf05ff6ce1f2e77afce914cd249 (diff) | |
download | tissue-08afa8b0548b2870a36f1a30ba3c4dc7f515f169.tar.gz tissue-08afa8b0548b2870a36f1a30ba3c4dc7f515f169.tar.lz tissue-08afa8b0548b2870a36f1a30ba3c4dc7f515f169.zip |
search: Do not use MSetIterator-mset-get.
We already have the mset from enquire-mset.
* tissue/search.scm (search-fold): Do not use
MSetIterator-mset-get. Reuse mset from enquire-mset.
-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))) |