improve behaviour when there is a single search term (#4570)
This commit is contained in:
parent
d20b6b4e5c
commit
a3ffae8322
|
@ -134,9 +134,7 @@ class ListKeywordsView(BrowserView):
|
||||||
other = []
|
other = []
|
||||||
q = query_string.lower()
|
q = query_string.lower()
|
||||||
regex = re.compile(r"[\s'()]")
|
regex = re.compile(r"[\s'()]")
|
||||||
q_words = regex.split(q)
|
|
||||||
items = self.getItems(query_string)
|
items = self.getItems(query_string)
|
||||||
done = {}
|
|
||||||
for normalized, title, id in items:
|
for normalized, title, id in items:
|
||||||
count_start = 0
|
count_start = 0
|
||||||
count_in = 0
|
count_in = 0
|
||||||
|
@ -148,7 +146,9 @@ class ListKeywordsView(BrowserView):
|
||||||
count_in += 1
|
count_in += 1
|
||||||
|
|
||||||
item = '%s|%s' % (title, id)
|
item = '%s|%s' % (title, id)
|
||||||
if count_start == len(query_terms):
|
if len(query_terms) == 1 and normalized.startswith(query_terms[0]):
|
||||||
|
absolute_startswith.append((normalized, item))
|
||||||
|
elif len(query_terms) > 1 and count_start == len(query_terms):
|
||||||
absolute_startswith.append((normalized, item))
|
absolute_startswith.append((normalized, item))
|
||||||
elif count_start >= 1:
|
elif count_start >= 1:
|
||||||
startswith.append((normalized, item))
|
startswith.append((normalized, item))
|
||||||
|
|
Reference in New Issue