Commit 10def95e authored by Bartek Górny's avatar Bartek Górny

Improved display of found data; changed search_mode identifiers to human readable.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent de3ca97c
import string, re import string, re
redundant_chars='"\'.:;,-' # chars we need to strip from a word before we see if it matches redundant_chars='"\'.:;,-+<>()*~' # chars we need to strip from a word before we see if it matches, and from the searchwords to eliminate boolean mode chars
tr=string.maketrans(redundant_chars,' '*len(redundant_chars)) tr=string.maketrans(redundant_chars,' '*len(redundant_chars))
class Done(Exception): class Done(Exception):
...@@ -42,6 +42,7 @@ class Part: ...@@ -42,6 +42,7 @@ class Part:
def generateParts(context,text,sw,tags,trail,maxlines): def generateParts(context,text,sw,tags,trail,maxlines):
par=Part(tags,trail) par=Part(tags,trail)
sw=sw.translate(tr).strip().split()
test=lambda w:w.translate(tr).strip() in sw test=lambda w:w.translate(tr).strip() in sw
i=0 i=0
for aw in text: for aw in text:
......
...@@ -77,7 +77,6 @@ txt=brain.getObject().SearchableText()\n ...@@ -77,7 +77,6 @@ txt=brain.getObject().SearchableText()\n
sw=context.REQUEST.get(\'SearchableText\',None)\n sw=context.REQUEST.get(\'SearchableText\',None)\n
if sw is None:\n if sw is None:\n
return \'\'\n return \'\'\n
sw=sw.split()\n
res=context.cutFound(context,txt,sw,tags,trail,maxlines)\n res=context.cutFound(context,txt,sw,tags,trail,maxlines)\n
return \' \'.join(map(str,res))\n return \' \'.join(map(str,res))\n
......
...@@ -231,11 +231,11 @@ ...@@ -231,11 +231,11 @@
</tuple> </tuple>
<tuple> <tuple>
<string>Boolean</string> <string>Boolean</string>
<string>1</string> <string>in_boolean_mode</string>
</tuple> </tuple>
<tuple> <tuple>
<string>With query expansion</string> <string>With query expansion</string>
<string>2</string> <string>with_query_expansion</string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
19 28
\ 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