From bf1a29edfee131931741ae6f7c20a9545846ff13 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 27 Jun 2022 22:46:33 +0530 Subject: search: Add search-map. * tissue/search.scm (search-map): New function. --- tissue/search.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tissue/search.scm b/tissue/search.scm index a257bbf..647ae5b 100644 --- a/tissue/search.scm +++ b/tissue/search.scm @@ -66,3 +66,19 @@ first call." initial (enquire-mset (enquire db query) #:maximum-items (database-document-count db))))) + +(define (search-map proc db search-terms) + "Search xapian database DB using SEARCH-TERMS and map over the results +using PROC. SEARCH-TERMS are a list of search terms that are joined +with the \"AND\" operator. + +PROC is invoked as (PROC DOCUMENT MSET). DOCUMENT is an instance of + or one of its subclasses. MSET is the xapian MSet object +representing the search results." + (reverse + (search-fold (lambda (document mset result) + (cons (proc document mset) + result)) + '() + db + search-terms))) -- cgit v1.2.3