Commit 4cc5fb5d authored by Jérome Perrin's avatar Jérome Perrin

don't use select_expression in countResults, because we are only interested in count(catalog.uid).

(countResults with SearcheableText was broken)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11947 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 644d0255
......@@ -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
......
......@@ -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())])
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