Commit c30e1675 authored by Ivan Tyagov's avatar Ivan Tyagov

If in gadget mode show less text overview of shown document.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24756 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 74af30c8
...@@ -105,7 +105,12 @@ if search_words in (\'\', None,):\n ...@@ -105,7 +105,12 @@ if search_words in (\'\', None,):\n
if not isinstance(document_text, str): \n if not isinstance(document_text, str): \n
document_text = str(document_text)\n document_text = str(document_text)\n
# try to get somewhat arbitrary choice of searchable attrs\n # try to get somewhat arbitrary choice of searchable attrs\n
result = document_text[min(len(document_text) - 300, 200) : 1500]\n max_text_length = 500\n
start = min(len(document_text) - 300, 200)\n
if context.REQUEST.get(\'is_gadget_mode\', 0):\n
# in gadget mode less space is available thus show less text\n
max_text_length = 150\n
result = \'%s ...\' %document_text[start:start + max_text_length]\n
return result\n return result\n
\n \n
# get fragments of text containing searched words\n # get fragments of text containing searched words\n
...@@ -182,8 +187,10 @@ return result\n ...@@ -182,8 +187,10 @@ return result\n
<string>result</string> <string>result</string>
<string>isinstance</string> <string>isinstance</string>
<string>str</string> <string>str</string>
<string>max_text_length</string>
<string>min</string> <string>min</string>
<string>len</string> <string>len</string>
<string>start</string>
<string>found_text_fragments</string> <string>found_text_fragments</string>
<string>map</string> <string>map</string>
<string>unicode_result</string> <string>unicode_result</string>
......
939 941
\ No newline at end of file \ 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