racket/collects/little-helper/web-root/servlets/private/request.scm
Jens Axel Soegaard ac47e02961 Initial checkin of Little Helper.
Little Helper contains a full text search engine. 
Currently it indexes all html-files in /collects/doc.
A mockup web-interface is present in order to facilitate easy experimentation with searches.
Run run-indexer to generate the index for your documentation dir. 
Run launch to start a web-server with the search interface.
Note: Currently assumes w3m is in your path (used to precompute the 
           preview-snippets shown in the search results.

svn: r8836
2008-03-01 13:26:18 +00:00

33 lines
853 B
Scheme

#lang scheme
(provide current-request
get-binding
get-type-normal
get-sensitivity
get-contain-all)
(require web-server/servlet)
(define current-request (make-parameter #f))
(define (get-binding sym default)
(if (current-request)
(with-handlers ([(λ (x) #t) (lambda (x) default)])
(extract-binding/single sym (request-bindings (current-request))))
default))
(define (convert v vs)
(let ([v (if (string? v) (string->symbol v) v)])
(cond [(assoc v vs) => cadr]
[else (error (list v vs))])))
(define (get-type-normal)
(convert (get-binding 't 'normal) '((normal #t) (regular #f))))
(define (get-sensitivity)
(convert (get-binding 's 'yes) '((yes #t) (no #f))))
(define (get-contain-all)
(convert (get-binding 'ca 'yes) '((yes #t) (no #f))))