Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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 )
Ejemplo n.º 4
0
def advancedSearch(req):
    """this supplies the advanced search interface"""
    ctx = searchContext.getSearchContext(req)
    return render_to_response( "search-advanced.html", ctx)
Ejemplo n.º 5
0
def openSearchDescription(req):
    ctx = searchContext.getSearchContext(req)
    resp = render_to_response("openSearchDescription.html", ctx)
    resp.headers['Content-Type'] = "application/opensearchdescription+xml"
    return resp