Commit 9d491ed7 authored by Ivan Tyagov's avatar Ivan Tyagov

Generate search string following this format:

<existing_search_string> OPERATOR (portal_type:value1 OR portal_type:value2)

rather than as before:

<existing_search_string> portal_type:value1 OR portal_type:value2

which have a totally different meaning and generates a wrong query.
Make sure that OPERATOR is configurable (default='AND')

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38402 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db1e91e6
...@@ -108,7 +108,7 @@ if portal_type_list:\n ...@@ -108,7 +108,7 @@ if portal_type_list:\n
if \' \' in portal_type:\n if \' \' in portal_type:\n
portal_type = \'"%s"\' %portal_type\n portal_type = \'"%s"\' %portal_type\n
portal_type_string_list.append(\'portal_type:%s\' %portal_type)\n portal_type_string_list.append(\'portal_type:%s\' %portal_type)\n
search_string += \' %s\' %\' OR \'.join(portal_type_string_list)\n search_string += \' %s (%s)\' %(logical_operator, \' OR \'.join(portal_type_string_list))\n
\n \n
# search by reference\n # search by reference\n
reference = kw.get(\'reference\', request.get(\'reference\', None))\n reference = kw.get(\'reference\', request.get(\'reference\', None))\n
...@@ -166,7 +166,7 @@ return search_string\n ...@@ -166,7 +166,7 @@ return search_string\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>logical_operator=\'AND\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -186,12 +186,13 @@ return search_string\n ...@@ -186,12 +186,13 @@ return search_string\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>logical_operator</string>
<string>kw</string> <string>kw</string>
<string>None</string> <string>None</string>
<string>MARKER</string> <string>MARKER</string>
...@@ -235,7 +236,9 @@ return search_string\n ...@@ -235,7 +236,9 @@ return search_string\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<string>AND</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
1173 1175
\ 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