summaryrefslogtreecommitdiff
path: root/searx/webutils.py
diff options
context:
space:
mode:
authorDaniel Hones <danielhones@gmail.com>2021-02-08 23:58:54 -0500
committerDaniel Hones <danielhones@gmail.com>2021-02-08 23:58:54 -0500
commit138f32471c5dfe12299471037782ac353462be74 (patch)
tree0f2ef0a6f050e9e7b77b99f9ddaec304f1b3a4e7 /searx/webutils.py
parentab8739809c8c5f4c1f12e4b15fa8c61afe30ef9f (diff)
downloadsearxng-138f32471c5dfe12299471037782ac353462be74.tar.gz
searxng-138f32471c5dfe12299471037782ac353462be74.zip
Updated webutils.highlight_content to ignore double-quotes when highlighting query parts
Diffstat (limited to 'searx/webutils.py')
-rw-r--r--searx/webutils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/webutils.py b/searx/webutils.py
index 8be8fcecd..2464a097f 100644
--- a/searx/webutils.py
+++ b/searx/webutils.py
@@ -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)))