DO not change the query value while looping

This commit is contained in:
Kovid Goyal 2013-06-13 14:03:08 +05:30
parent 4787801c0d
commit 74d1e247f1

View File

@ -405,6 +405,7 @@ class SearchFilter(SearchQueryParser):
for sr in self.srs:
for locvalue in locations:
final_query = query
accessor = q[locvalue]
if query == 'true':
# True/False.
@ -451,10 +452,10 @@ class SearchFilter(SearchQueryParser):
elif locvalue in ('author2', 'title2'):
m = self.IN_MATCH
vals = re.sub(r'(^|\s)(and|not|or|a|the|is|of|,)(\s|$)', ' ', accessor(sr)).split(' ')
query = query.lower()
final_query = query.lower()
else:
vals = [accessor(sr)]
if self._match(query, vals, m):
if self._match(final_query, vals, m):
matches.add(sr)
break
except ValueError: # Unicode errors