fix search to be against normalized title

This commit is contained in:
Frédéric Péters 2013-09-24 15:44:37 +02:00
parent efba88a95d
commit be6588aa7b
1 changed files with 5 additions and 4 deletions

View File

@ -127,16 +127,17 @@ class ListKeywordsView(BrowserView):
other = []
q = query_string.lower()
regex = re.compile(r"[\s'()]")
for normalized, title, id in self.getItems():
items = self.getItems()
for normalized, title, id in items:
for term in query_terms:
if not term in title.lower():
if not term in normalized.lower():
break
else:
item = '%s|%s' % (title, id)
if title.lower().startswith(q):
if normalized.lower().startswith(q):
startswith.append((normalized, item))
continue
for word in regex.split(title):
for word in regex.split(normalized):
if word.lower().startswith(q):
intermediate.append((normalized, item))
break