summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-06-27 22:46:33 +0530
committerArun Isaac2022-06-28 10:05:06 +0530
commitbf1a29edfee131931741ae6f7c20a9545846ff13 (patch)
tree8d091c1d9b389389121f21a221fbcb2f5bfb555f
parentebf1d504bedc39fa43ae0df179d40e411b215dc5 (diff)
downloadtissue-bf1a29edfee131931741ae6f7c20a9545846ff13.tar.gz
tissue-bf1a29edfee131931741ae6f7c20a9545846ff13.tar.lz
tissue-bf1a29edfee131931741ae6f7c20a9545846ff13.zip
search: Add search-map.
* tissue/search.scm (search-map): New function.
-rw-r--r--tissue/search.scm16
1 files changed, 16 insertions, 0 deletions
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
+<document> 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)))