Commit 537a5158 authored by Romain Courteaud's avatar Romain Courteaud

Do not extract text if no search words are found.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26411 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9fa0d1cb
......@@ -68,23 +68,27 @@ else:\n
params = context.portal_selections.getSelectionParamsFor(\'search_result_selection\')\n
search_words = params.get(\'your_search_text\')\n
\n
if document_text is None:\n
document_text = context.getSearchableText()\n
if search_words is None:\n
return \'\'\n
else:\n
\n
if document_text is None:\n
document_text = context.getSearchableText()\n
\n
found_text_fragments = context.Base_getExcerptText(\n
context, \\\n
document_text, \\\n
search_words, \\\n
tags = (\'<em>\', \'</em>\'), \\\n
trail = 5, \\\n
maxlines = max_lines)\n
result = \' \'.join(map(str, found_text_fragments))\n
found_text_fragments = context.Base_getExcerptText(\n
context, \\\n
document_text, \\\n
search_words, \\\n
tags = (\'<em>\', \'</em>\'), \\\n
trail = 5, \\\n
maxlines = max_lines)\n
result = \' \'.join(map(str, found_text_fragments))\n
\n
# Document may contains charactors which utf8 codec cannot decode.\n
unicode_result = result.decode(\'utf-8\', \'ignore\')\n
result = unicode_result.encode(\'utf-8\')\n
# Document may contains charactors which utf8 codec cannot decode.\n
unicode_result = result.decode(\'utf-8\', \'ignore\')\n
result = unicode_result.encode(\'utf-8\')\n
\n
return result\n
return result\n
]]></string> </value>
......
1151
\ No newline at end of file
1153
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment