From 9d491ed7f1e4f81727509f507a1f06558846317e Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Thu, 16 Sep 2010 07:54:39 +0000 Subject: [PATCH] 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 --- .../erp5_dms/Base_assembleSearchString.xml | 11 +++++++---- bt5/erp5_dms/bt/revision | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_assembleSearchString.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_assembleSearchString.xml index 6e8773d220..ddfd9142ff 100644 --- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_assembleSearchString.xml +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_assembleSearchString.xml @@ -108,7 +108,7 @@ if portal_type_list:\n if \' \' in portal_type:\n 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 # search by reference\n reference = kw.get(\'reference\', request.get(\'reference\', None))\n @@ -166,7 +166,7 @@ return search_string\n </item> <item> <key> <string>_params</string> </key> - <value> <string>**kw</string> </value> + <value> <string>logical_operator=\'AND\', **kw</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -186,12 +186,13 @@ return search_string\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>logical_operator</string> <string>kw</string> <string>None</string> <string>MARKER</string> @@ -235,7 +236,9 @@ return search_string\n <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <string>AND</string> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision index 1720e6f2b5..66dae0a039 100644 --- a/bt5/erp5_dms/bt/revision +++ b/bt5/erp5_dms/bt/revision @@ -1 +1 @@ -1173 \ No newline at end of file +1175 \ No newline at end of file -- 2.30.9