From bf7de5482427766614fe42f9605d7c4c1395065b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 22 Aug 2013 10:29:41 +0200 Subject: [PATCH] use a better split on words --- src/collective/dms/thesaurus/browser/thesaurusview.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/collective/dms/thesaurus/browser/thesaurusview.py b/src/collective/dms/thesaurus/browser/thesaurusview.py index 269d1ca..5e1d94a 100644 --- a/src/collective/dms/thesaurus/browser/thesaurusview.py +++ b/src/collective/dms/thesaurus/browser/thesaurusview.py @@ -1,4 +1,5 @@ import json +import re from zope.interface import implementer from zope.interface import implements @@ -127,6 +128,7 @@ class ListKeywordsView(BrowserView): intermediate = [] other = [] q = query_string.lower() + regex = re.compile(r"[\s'()]") for normalized, title, id in self.getItems(): for term in query_terms: if not term in title.lower(): @@ -136,7 +138,7 @@ class ListKeywordsView(BrowserView): if title.lower().startswith(q): startswith.append((normalized, item)) continue - for word in title.split(): + for word in regex.split(title): if word.lower().startswith(q): intermediate.append((normalized, item)) break