diff --git a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml index 93b563c339ae6bf5ac8bb7d1f8a65bb2a578d595..041188d898b95b6826ef1ec0d193457d676aae3e 100644 --- a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml +++ b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml @@ -69,11 +69,11 @@ <key> <string>_keys</string> </key> <value> <list> - <string>from_table_list</string> - <string>where_expression</string> - <string>select_expression</string> - <string>selection_domain</string> - <string>selection_report</string> +<string>from_table_list</string> +<string>where_expression</string> +<string>select_expression</string> +<string>selection_domain</string> +<string>selection_report</string> </list> </value> </item> @@ -136,9 +136,6 @@ selection_report</string> </value> SELECT\n COUNT(DISTINCT catalog.uid) <dtml-comment>We need subselect for better statistics</dtml-comment>\n -<dtml-if select_expression>\n - , <dtml-var select_expression>\n -</dtml-if>\n FROM\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-if selection_domain>\n @@ -210,9 +207,6 @@ ORDER BY\n SELECT\n COUNT(DISTINCT catalog.uid) <dtml-comment>We need subselect for better statistics</dtml-comment>\n -<dtml-if select_expression>\n - , <dtml-var select_expression>\n -</dtml-if>\n FROM\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-if selection_domain>\n diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py index bb70e58687ecac3be3560c3b5725a7d35c1d4d7e..af702d94e81f6603456de4c0bf77b4f08b77f991 100644 --- a/product/ERP5Catalog/tests/testERP5Catalog.py +++ b/product/ERP5Catalog/tests/testERP5Catalog.py @@ -1204,7 +1204,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ob = folder.newContent() ob.setTitle('The title of this object') self.failUnless('this' in ob.SearchableText(), ob.SearchableText()) - # add some other objects, we + # add some other objects, we need to create a minimum quantity of data for + # full text queries to work correctly for i in range(10): otherob = folder.newContent() otherob.setTitle('Something different') @@ -1222,6 +1223,12 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): [x.getObject for x in self.getCatalogTool()( portal_type='Organisation', SearchableText='different')]) + # test countResults + self.assertEquals(1, self.getCatalogTool().countResults( + portal_type='Organisation', SearchableText='title')[0][0]) + self.assertEquals(0, self.getCatalogTool().countResults( + portal_type='Organisation', SearchableText='different')[0][0]) + def test_43_ManagePasteObject(self, quiet=quiet, run=run_all_test): if not run: return if not quiet: @@ -1257,3 +1264,4 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): [x.getObject() for x in self.getCatalogTool()( parent_title=person_module.getTitle())]) +