1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

[mod] truncate result content in html - closes #224

This commit is contained in:
Adam Tauber 2016-09-05 22:22:25 +02:00
parent 94b5f2ca77
commit da4f1c2512

View File

@ -395,11 +395,9 @@ def index():
search.paging = True search.paging = True
if search.request_data.get('format', 'html') == 'html': if search.request_data.get('format', 'html') == 'html':
if 'content' in result: if 'content' in result and result['content']:
result['content'] = highlight_content(result['content'], result['content'] = highlight_content(result['content'][:1024], search.query.encode('utf-8'))
search.query.encode('utf-8')) # noqa result['title'] = highlight_content(result['title'], search.query.encode('utf-8'))
result['title'] = highlight_content(result['title'],
search.query.encode('utf-8'))
else: else:
if result.get('content'): if result.get('content'):
result['content'] = html_to_text(result['content']).strip() result['content'] = html_to_text(result['content']).strip()
@ -559,7 +557,6 @@ def preferences():
lang = request.preferences.get_value('language') lang = request.preferences.get_value('language')
disabled_engines = request.preferences.engines.get_disabled() disabled_engines = request.preferences.engines.get_disabled()
allowed_plugins = request.preferences.plugins.get_enabled() allowed_plugins = request.preferences.plugins.get_enabled()
results_on_new_tab = request.preferences.get_value('results_on_new_tab')
# stats for preferences page # stats for preferences page
stats = {} stats = {}