[Erp5-report] r11947 - in /erp5/trunk/products: ERP5/bootstrap/erp5_core/CatalogMethodTempl...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 8 22:29:27 CET 2007


Author: jerome
Date: Mon Jan  8 22:29:24 2007
New Revision: 11947

URL: http://svn.erp5.org?rev=11947&view=rev
Log:
don't use select_expression in countResults, because we are only interested in count(catalog.uid).
(countResults with SearcheableText was broken)


Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml
    erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml?rev=11947&r1=11946&r2=11947&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_count_results.xml Mon Jan  8 22:29:24 2007
@@ -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 @@
 
 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 @@
 
 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

Modified: erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py?rev=11947&r1=11946&r2=11947&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py (original)
+++ erp5/trunk/products/ERP5Catalog/tests/testERP5Catalog.py Mon Jan  8 22:29:24 2007
@@ -1204,7 +1204,8 @@
     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 @@
         [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 @@
         [x.getObject() for x in self.getCatalogTool()(
                parent_title=person_module.getTitle())])
     
+




More information about the Erp5-report mailing list