From d9c130eb1119153874abdcdc7d4e8e84580b40ca Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 29 Jun 2022 15:25:46 +0530 Subject: web: server: List search results even on home page. * tissue/web/server.scm (handler): List search results even on home page. --- tissue/web/server.scm | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tissue/web/server.scm b/tissue/web/server.scm index c5c67b5..55e57e1 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -160,20 +160,17 @@ to a stylesheet." (request-method request) path) (cond - ((string=? path "/") - (values '((content-type . (text/html))) - (sxml->html (make-search-page '() "" css)))) - ((string=? "/search" path) - (values '((content-type . (text/html))) - (sxml->html - (make-search-page - (call-with-database xapian-index - (lambda (db) - (search-map document->sxml - db - (assoc-ref parameters "query")))) - (assoc-ref parameters "query") - css)))) + ((member path (list "/" "/search")) + (let ((search-query (or (assoc-ref parameters "query") + ""))) + (values '((content-type . (text/html))) + (sxml->html + (make-search-page + (call-with-database xapian-index + (lambda (db) + (search-map document->sxml db search-query))) + search-query + css))))) (else (values (build-response #:code 404) (string-append "Resource not found: " -- cgit v1.2.3