Commit 574a55e4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

added support for text data streams (with no len support)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14357 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent de988655
...@@ -108,6 +108,7 @@ search_words = search_argument_list.get(\'SearchableText\')\n ...@@ -108,6 +108,7 @@ search_words = search_argument_list.get(\'SearchableText\')\n
if search_words is None or search_words == \'\':\n if search_words is None or search_words == \'\':\n
# if the searched text is empty (e.g. because we used only parameters without pure searchable text)\n # if the searched text is empty (e.g. because we used only parameters without pure searchable text)\n
# we return something\n # we return something\n
if not hasattr(txt, \'len\'): txt = str(txt)\n
return txt[min(len(txt) - 300, 200) : 500] # a somewhat arbitrary choice to trim searchable attrs\n return txt[min(len(txt) - 300, 200) : 500] # a somewhat arbitrary choice to trim searchable attrs\n
\n \n
res = context.cutFound(context, txt, search_words, tags, trail, maxlines)\n res = context.cutFound(context, txt, search_words, tags, trail, maxlines)\n
...@@ -184,11 +185,11 @@ return \' \'.join(map(str, res))\n ...@@ -184,11 +185,11 @@ return \' \'.join(map(str, res))\n
<string>search_argument_list</string> <string>search_argument_list</string>
<string>search_words</string> <string>search_words</string>
<string>None</string> <string>None</string>
<string>str</string>
<string>min</string> <string>min</string>
<string>len</string> <string>len</string>
<string>res</string> <string>res</string>
<string>map</string> <string>map</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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