def search(request):
    query_string = prepare_solr_query_string(request.GET.get('q', ""))
    search_terms = query_string.split()
    index_query = SearchQuerySet().models(Project)
    spelling_suggestion = None
    #FIXME: Workaround for https://github.com/toastdriven/django-haystack/issues/364
    # Only the else part should be necessary.
    if settings.HAYSTACK_SEARCH_ENGINE == 'simple':
        results = index_query.auto_query(query_string)
    else:
        try:
            qfilter = fulltext_project_search_filter(query_string)
            results = index_query.filter(qfilter)
            spelling_suggestion = results.spelling_suggestion(query_string)
        except __HOLE__:
            results = []

    logger.debug("Searched for %s. Found %s results." % (query_string, len(results)))
    return render_to_response("search.html",
        {'query': query_string,
         'terms': search_terms,
         'results': results,
         'spelling_suggestion': spelling_suggestion},
          context_instance = RequestContext(request))
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/views.py/search