#NEWLINE# def search( request ) : #NEWLINE# #INDENT# query_string = prepare_solr_query_string ( request . GET . get ( 'q' , '' ) ) #NEWLINE# search_terms = query_string . split ( ) #NEWLINE# index_query = SearchQuerySet ( ) . models ( Project ) #NEWLINE# spelling_suggestion = None #NEWLINE# if ( settings . HAYSTACK_SEARCH_ENGINE == 'simple' ) : #NEWLINE# #INDENT# results = index_query . auto_query ( query_string ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# qfilter = fulltext_project_search_filter ( query_string ) #NEWLINE# results = index_query . filter ( qfilter ) #NEWLINE# spelling_suggestion = results . spelling_suggestion ( query_string ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# results = [ ] #NEWLINE# #UNINDENT# #UNINDENT# logger . debug ( ( 'Searched for %s. Found %s results.' % ( query_string , len ( results ) ) ) ) #NEWLINE# return render_to_response ( 'search.html' , { #NEWLINE# #INDENT# 'query' : query_string , #NEWLINE# 'terms' : search_terms , #NEWLINE# 'results' : results , #NEWLINE# 'spelling_suggestion' : spelling_suggestion , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )