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:
@@ -10,15 +10,16 @@ from .settings import RECENT_COUNT
|
||||
|
||||
|
||||
class RecentSearchManager(models.Manager):
|
||||
def add_query_for_user(self, user, query, hits):
|
||||
parsed_query = urlparse.parse_qs(urlencode(dict(query.items())))
|
||||
def add_query_for_user(self, user, query_string, hits):
|
||||
parsed_query = urlparse.parse_qs(urlencode(dict(query_string.items())))
|
||||
|
||||
for key, value in parsed_query.items():
|
||||
parsed_query[key] = ' '.join(value)
|
||||
|
||||
if 'q=' in query:
|
||||
if 'q' in query_string:
|
||||
# Is a simple query
|
||||
if not parsed_query.get('q'):
|
||||
|
||||
if not query_string['q']:
|
||||
# Don't store empty simple searches
|
||||
return
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user