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:
Roberto Rosario
2014-12-11 19:52:24 -04:00
parent 1a8ab7956f
commit d0aaa256cd
5 changed files with 36 additions and 95 deletions
+5 -4
View File
@@ -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: