forked from Icycoide/searxng
Updated webutils.highlight_content to ignore double-quotes when highlighting query parts
This commit is contained in:
parent
ab8739809c
commit
138f32471c
3 changed files with 27 additions and 2 deletions
|
@ -119,7 +119,10 @@ def highlight_content(content, query):
|
|||
else:
|
||||
regex_parts = []
|
||||
for chunk in query.split():
|
||||
if len(chunk) == 1:
|
||||
chunk = chunk.replace('"', '')
|
||||
if len(chunk) == 0:
|
||||
continue
|
||||
elif len(chunk) == 1:
|
||||
regex_parts.append('\\W+{0}\\W+'.format(re.escape(chunk)))
|
||||
else:
|
||||
regex_parts.append('{0}'.format(re.escape(chunk)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue