diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-09-05 22:22:25 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-09-05 22:22:25 +0200 |
commit | da4f1c25126ac15e38f428ed1469c4d1d9b149d3 (patch) | |
tree | 4342f8cbf32e54a41545f4dd815e0a23d6a15139 | |
parent | 94b5f2ca7736d569a86196e57b75c2198a94acba (diff) | |
download | searxng-da4f1c25126ac15e38f428ed1469c4d1d9b149d3.tar.gz searxng-da4f1c25126ac15e38f428ed1469c4d1d9b149d3.zip |
[mod] truncate result content in html - closes #224
-rw-r--r-- | searx/webapp.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 800bde004..362f6e502 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -395,11 +395,9 @@ def index(): search.paging = True if search.request_data.get('format', 'html') == 'html': - if 'content' in result: - result['content'] = highlight_content(result['content'], - search.query.encode('utf-8')) # noqa - result['title'] = highlight_content(result['title'], - search.query.encode('utf-8')) + if 'content' in result and result['content']: + result['content'] = highlight_content(result['content'][:1024], search.query.encode('utf-8')) + result['title'] = highlight_content(result['title'], search.query.encode('utf-8')) else: if result.get('content'): result['content'] = html_to_text(result['content']).strip() @@ -559,7 +557,6 @@ def preferences(): lang = request.preferences.get_value('language') disabled_engines = request.preferences.engines.get_disabled() allowed_plugins = request.preferences.plugins.get_enabled() - results_on_new_tab = request.preferences.get_value('results_on_new_tab') # stats for preferences page stats = {} |