diff --git a/collects/help/search.ss b/collects/help/search.ss index 56a0299f..84222240 100644 --- a/collects/help/search.ss +++ b/collects/help/search.ss @@ -3,7 +3,7 @@ (require setup/dirs net/sendurl net/uri-codec) (provide perform-search send-main-page) -(define search-page "search/index.html") +(define search-dir "search/") ;; Almost nothing to do here -- the real work is done in the browser, ;; using javascript. @@ -14,5 +14,10 @@ [path (if (file-exists? path) path (build-path (find-doc-dir) sub))]) (send-url/file path #:fragment fragment #:query query))) -(define (perform-search str) - (send-main-page #:sub search-page #:query (format "q=~a" (uri-encode str)))) +(define (perform-search str [context #f]) + (let* ([page (if context "search-context.htm" "index.html")] + [query (format "q=~a" (uri-encode str))] + [query (if context + (format "~a&hq=~a" query (uri-encode context)) + query)]) + (send-main-page #:sub (string-append search-dir page) #:query query)))