def about(req):
    ctx = searchContext.getSearchContext(req)
    # we do not want the search box on the "about" screen to contain anything.
    # TODO: fix this hack by making getSearchContext return appropriate thing based on view
    del ctx['q']
    del ctx['qDisplay']    
    #ctx['PRESENTATION'] = searchContext.doPresentation()
    return render_to_response("about.html", ctx)
def noHits(req):
    #return HttpResponse("no hits found!")
    import spelling
    ctx = searchContext.getSearchContext( req )
    # TODO: try the cache for suggestions first
    # TODO: keep some kind of counter on Yahoo web service use so we don't break the internet
    fromSpellcheck = req.GET.get('spellcheck', None)
    if fromSpellcheck is not None:
        ctx['spellcheck_failed'] = 1
    else:
        suggestions = spelling.spellCheck( ctx['qDisplay'] )
        if len(suggestions) > 0:
            ctx['spelling_suggestions' ] = suggestions
        
    # TODO: check against spellchecker here
    return render_to_response( "noHits.html", ctx)
def searchError( req ):
    #return HttpResponse("there was an error with your search. The problem has been logged.")
    ctx = searchContext.getSearchContext( req )
    return render_to_response( "error.html", ctx )
def advancedSearch(req):
    """this supplies the advanced search interface"""
    ctx = searchContext.getSearchContext(req)
    return render_to_response( "search-advanced.html", ctx)
def openSearchDescription(req):
    ctx = searchContext.getSearchContext(req)
    resp = render_to_response("openSearchDescription.html", ctx)
    resp.headers['Content-Type'] = "application/opensearchdescription+xml"
    return resp