Don't search blindly for all the fields passed in the advanced search, use the defined fields, avoid hard coded rejection of &page arguments in the query string. The SearchModel class is now responsible for storing the search in the recent entries instead of the view.
This commit is contained in:
@@ -34,15 +34,7 @@ def results(request, extra_context=None):
|
||||
# Only do search if there is user input, otherwise just render
|
||||
# the template with the extra_context
|
||||
|
||||
if 'q' in request.GET:
|
||||
# Simple query
|
||||
logger.debug('simple search')
|
||||
query_string = request.GET.get('q', u'').strip()
|
||||
queryset, ids, timedelta = document_search.simple_search(query_string)
|
||||
else:
|
||||
# Advanced search
|
||||
logger.debug('advanced search')
|
||||
queryset, ids, timedelta = document_search.advanced_search(request.GET)
|
||||
queryset, ids, timedelta = document_search.search(request.GET, request.user)
|
||||
|
||||
# Update the context with the search results
|
||||
context.update({
|
||||
@@ -51,8 +43,6 @@ def results(request, extra_context=None):
|
||||
'title': _(u'Results'),
|
||||
})
|
||||
|
||||
RecentSearch.objects.add_query_for_user(request.user, document_search, request.GET, len(ids))
|
||||
|
||||
if extra_context:
|
||||
context.update(extra_context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user