diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-02-09 08:39:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-09 08:39:07 +0100 |
| commit | 6c513095e4fb1f898dee84feea3719556759dd58 (patch) | |
| tree | 0f2ef0a6f050e9e7b77b99f9ddaec304f1b3a4e7 /searx | |
| parent | ab8739809c8c5f4c1f12e4b15fa8c61afe30ef9f (diff) | |
| parent | 138f32471c5dfe12299471037782ac353462be74 (diff) | |
Merge pull request #2553 from danielhones/improve-results-highlighting-updated
Ignore double-quotes when highlighting query parts
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/webutils.py | 5 |
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))) |