Commit d01b1107 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

disable using catalog_full_text for now.

parent d43af8f6
<key_list> <key_list>
<key>accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line</key> <key>accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line</key> <key>accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_mirror_section_title | catalog_full_text/title/z_related_accounting_transaction_mirror_section</key> <key>accounting_transaction_mirror_section_title | catalog/title/z_related_accounting_transaction_mirror_section</key>
<key>accounting_transaction_payment_title | catalog_full_text/title/z_related_accounting_transaction_payment</key> <key>accounting_transaction_payment_title | catalog/title/z_related_accounting_transaction_payment</key>
<key>accounting_transaction_project_title | catalog_full_text/title/z_related_accounting_transaction_project</key> <key>accounting_transaction_project_title | catalog/title/z_related_accounting_transaction_project</key>
<key>accounting_transaction_section_title | catalog_full_text/title/z_related_accounting_transaction_section</key> <key>accounting_transaction_section_title | catalog/title/z_related_accounting_transaction_section</key>
<key>preferred_gap_id | category,catalog/id/z_related_preferred_gap</key> <key>preferred_gap_id | category,catalog/id/z_related_preferred_gap</key>
<key>preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap</key> <key>preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap</key>
</key_list> </key_list>
\ No newline at end of file
preferred_gap_id | category,catalog/id/z_related_preferred_gap preferred_gap_id | category,catalog/id/z_related_preferred_gap
preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap
accounting_transaction_mirror_section_title | catalog_full_text/title/z_related_accounting_transaction_mirror_section accounting_transaction_mirror_section_title | catalog/title/z_related_accounting_transaction_mirror_section
accounting_transaction_section_title | catalog_full_text/title/z_related_accounting_transaction_section accounting_transaction_section_title | catalog/title/z_related_accounting_transaction_section
accounting_transaction_project_title | catalog_full_text/title/z_related_accounting_transaction_project accounting_transaction_project_title | catalog/title/z_related_accounting_transaction_project
accounting_transaction_payment_title | catalog_full_text/title/z_related_accounting_transaction_payment accounting_transaction_payment_title | catalog/title/z_related_accounting_transaction_payment
accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line
accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<key>child_address_SearchableText | catalog,full_text/SearchableText/z_related_child_address</key> <key>child_address_SearchableText | catalog,full_text/SearchableText/z_related_child_address</key>
<key>child_telephone_SearchableText | catalog,full_text/SearchableText/z_related_child_telephone</key> <key>child_telephone_SearchableText | catalog,full_text/SearchableText/z_related_child_telephone</key>
<key>default_email_text | catalog,email/url_string/z_related_default_email</key> <key>default_email_text | catalog,email/url_string/z_related_default_email</key>
<key>destination_person_title | category,catalog,catalog_full_text/title/z_related_destination_person_full_text</key> <key>destination_person_title | category,catalog/title/z_related_destination_person</key>
<key>related_resource_use_uid | category,category,catalog,catalog/uid/z_related_resource_use</key> <key>related_resource_use_uid | category,category,catalog,catalog/uid/z_related_resource_use</key>
<key>source_organisation_title | category,catalog,catalog_full_text/title/z_related_source_organisation_full_text</key> <key>source_organisation_title | category,catalog/title/z_related_source_organisation</key>
<key>source_person_title | category,catalog,catalog_full_text/title/z_related_source_person_full_text</key> <key>source_person_title | category,catalog/title/z_related_source_person</key>
</key_list> </key_list>
\ No newline at end of file
source_organisation_title | category,catalog,catalog_full_text/title/z_related_source_organisation_full_text source_organisation_title | category,catalog/title/z_related_source_organisation
source_person_title | category,catalog,catalog_full_text/title/z_related_source_person_full_text source_person_title | category,catalog/title/z_related_source_person
destination_person_title | category,catalog,catalog_full_text/title/z_related_destination_person_full_text destination_person_title | category,catalog/title/z_related_destination_person
default_email_text | catalog,email/url_string/z_related_default_email default_email_text | catalog,email/url_string/z_related_default_email
related_resource_use_uid | category,category,catalog,catalog/uid/z_related_resource_use related_resource_use_uid | category,category,catalog,catalog/uid/z_related_resource_use
child_address_SearchableText | catalog,full_text/SearchableText/z_related_child_address child_address_SearchableText | catalog,full_text/SearchableText/z_related_child_address
......
<key_list> <key_list>
<key>career_skill_title | category,catalog,catalog_full_text/title/z_related_career_skill</key> <key>career_skill_title | category,catalog,catalog/title/z_related_career_skill</key>
<key>description | catalog_full_text/description/z_related_uid</key> <key>parent_description | catalog/description/z_related_parent</key>
<key>parent_description | catalog_full_text/description/z_related_parent</key> <key>parent_title | catalog/title/z_related_parent</key>
<key>parent_title | catalog_full_text/title/z_related_parent</key> <key>stock_explanation_title | catalog/title/z_related_explanation_from_stock</key>
<key>stock_explanation_title | catalog_full_text/title/z_related_explanation_from_stock</key> <key>stock_mirror_section_title | catalog/title/z_related_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_title | catalog_full_text/title/z_related_mirror_section_uid_from_stock</key> <key>stock_node_title | catalog/title/z_related_node_uid_from_stock</key>
<key>stock_node_title | catalog_full_text/title/z_related_node_uid_from_stock</key>
<key>title | catalog_full_text/title/z_related_uid</key>
</key_list> </key_list>
\ No newline at end of file
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
<key>SearchableText | MroongaBooleanFullTextKey</key> <key>SearchableText | MroongaBooleanFullTextKey</key>
<key>catalog_full_text.description | MroongaBooleanFullTextKey</key> <key>catalog_full_text.description | MroongaBooleanFullTextKey</key>
<key>catalog_full_text.title | MroongaBooleanFullTextKey</key> <key>catalog_full_text.title | MroongaBooleanFullTextKey</key>
<key>description | MroongaBooleanFullTextKey</key>
<key>full_text.SearchableText | MroongaBooleanFullTextKey</key> <key>full_text.SearchableText | MroongaBooleanFullTextKey</key>
<key>title | MroongaBooleanFullTextKey</key>
</key_list> </key_list>
\ No newline at end of file
career_skill_title | category,catalog,catalog_full_text/title/z_related_career_skill career_skill_title | category,catalog,catalog/title/z_related_career_skill
description | catalog_full_text/description/z_related_uid parent_description | catalog/description/z_related_parent
parent_description | catalog_full_text/description/z_related_parent parent_title | catalog/title/z_related_parent
parent_title | catalog_full_text/title/z_related_parent stock_explanation_title | catalog/title/z_related_explanation_from_stock
stock_explanation_title | catalog_full_text/title/z_related_explanation_from_stock stock_mirror_section_title | catalog/title/z_related_mirror_section_uid_from_stock
stock_mirror_section_title | catalog_full_text/title/z_related_mirror_section_uid_from_stock stock_node_title | catalog/title/z_related_node_uid_from_stock
stock_node_title | catalog_full_text/title/z_related_node_uid_from_stock \ No newline at end of file
title | catalog_full_text/title/z_related_uid
\ No newline at end of file
SearchableText | MroongaBooleanFullTextKey SearchableText | MroongaBooleanFullTextKey
catalog_full_text.description | MroongaBooleanFullTextKey catalog_full_text.description | MroongaBooleanFullTextKey
catalog_full_text.title | MroongaBooleanFullTextKey catalog_full_text.title | MroongaBooleanFullTextKey
description | MroongaBooleanFullTextKey full_text.SearchableText | MroongaBooleanFullTextKey
full_text.SearchableText | MroongaBooleanFullTextKey \ No newline at end of file
title | MroongaBooleanFullTextKey
\ No newline at end of file
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
<key>SearchableText</key> <key>SearchableText</key>
<key>catalog_full_text.description</key> <key>catalog_full_text.description</key>
<key>catalog_full_text.title</key> | <key>catalog_full_text.title</key> |
<key>description</key> |
<key>full_text.SearchableText</key> | <key>full_text.SearchableText</key> |
<key>title</key> |
</key_list> </key_list>
\ No newline at end of file
<key_list> <key_list>
<key>career_skill_title | category,catalog,catalog_full_text/title/z_related_career_skill</key> <key>career_skill_title | category,catalog,catalog/title/z_related_career_skill</key>
<key>description | catalog_full_text/description/z_related_uid</key> <key>parent_description | catalog/description/z_related_parent</key>
<key>parent_description | catalog_full_text/description/z_related_parent</key> <key>parent_title | catalog/title/z_related_parent</key>
<key>parent_title | catalog_full_text/title/z_related_parent</key> <key>stock_explanation_title | catalog/title/z_related_explanation_from_stock</key>
<key>stock_explanation_title | catalog_full_text/title/z_related_explanation_from_stock</key> <key>stock_mirror_section_title | catalog/title/z_related_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_title | catalog_full_text/title/z_related_mirror_section_uid_from_stock</key> <key>stock_node_title | catalog/title/z_related_node_uid_from_stock</key>
<key>stock_node_title | catalog_full_text/title/z_related_node_uid_from_stock</key> </key_list>
<key>title | catalog_full_text/title/z_related_uid</key>
</key_list>
\ No newline at end of file
SearchableText SearchableText
catalog_full_text.description catalog_full_text.description
catalog_full_text.title catalog_full_text.title
description full_text.SearchableText
full_text.SearchableText \ No newline at end of file
title
\ No newline at end of file
career_skill_title | category,catalog,catalog_full_text/title/z_related_career_skill career_skill_title | category,catalog,catalog/title/z_related_career_skill
description | catalog_full_text/description/z_related_uid parent_description | catalog/description/z_related_parent
parent_description | catalog_full_text/description/z_related_parent parent_title | catalog/title/z_related_parent
parent_title | catalog_full_text/title/z_related_parent stock_explanation_title | catalog/title/z_related_explanation_from_stock
stock_explanation_title | catalog_full_text/title/z_related_explanation_from_stock stock_mirror_section_title | catalog/title/z_related_mirror_section_uid_from_stock
stock_mirror_section_title | catalog_full_text/title/z_related_mirror_section_uid_from_stock stock_node_title | catalog/title/z_related_node_uid_from_stock
stock_node_title | catalog_full_text/title/z_related_node_uid_from_stock \ No newline at end of file
title | catalog_full_text/title/z_related_uid
\ No newline at end of file
<key_list> <key_list>
<key>item_catalog_portal_type | catalog/portal_type/z_related_item_catalog</key> <key>item_catalog_portal_type | catalog/portal_type/z_related_item_catalog</key>
<key>item_catalog_reference | catalog/reference/z_related_item_catalog</key> <key>item_catalog_reference | catalog/reference/z_related_item_catalog</key>
<key>item_catalog_title | catalog_full_text/title/z_related_item_catalog</key> <key>item_catalog_title | catalog/title/z_related_item_catalog</key>
<key>item_catalog_validation_state | catalog/validation_state/z_related_item_catalog</key> <key>item_catalog_validation_state | catalog/validation_state/z_related_item_catalog</key>
</key_list> </key_list>
\ No newline at end of file
item_catalog_title | catalog_full_text/title/z_related_item_catalog item_catalog_title | catalog/title/z_related_item_catalog
item_catalog_portal_type | catalog/portal_type/z_related_item_catalog item_catalog_portal_type | catalog/portal_type/z_related_item_catalog
item_catalog_reference | catalog/reference/z_related_item_catalog item_catalog_reference | catalog/reference/z_related_item_catalog
item_catalog_validation_state | catalog/validation_state/z_related_item_catalog item_catalog_validation_state | catalog/validation_state/z_related_item_catalog
\ No newline at end of file
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
import unittest import unittest
from unittest import expectedFailure
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class TestI18NSearch(ERP5TypeTestCase): class TestI18NSearch(ERP5TypeTestCase):
...@@ -37,56 +38,111 @@ class TestI18NSearch(ERP5TypeTestCase): ...@@ -37,56 +38,111 @@ class TestI18NSearch(ERP5TypeTestCase):
return ('erp5_full_text_mroonga_catalog', return ('erp5_full_text_mroonga_catalog',
'erp5_base',) 'erp5_base',)
def test_full_test_search(self): def afterSetUp(self):
person_module = self.portal.person_module self.person_module = self.portal.person_module
person1 = person_module.newContent( self.person1 = self.person_module.newContent(
portal_type='Person', portal_type='Person',
first_name='Gabriel', first_name='Gabriel',
last_name='Fauré', last_name='Fauré',
description='Quick brown fox jumps over the lazy dog.', description='Quick brown fox jumps over the lazy dog.',
) )
person2 = person_module.newContent( self.person2 = self.person_module.newContent(
portal_type='Person', portal_type='Person',
first_name='武者小路', first_name='武者小路',
last_name='実篤', last_name='実篤',
description='Slow white fox jumps over the diligent dog.', description='Slow white fox jumps over the diligent dog.',
) )
person3 = person_module.newContent( self.person3 = self.person_module.newContent(
portal_type='Person', portal_type='Person',
first_name='( - + )', first_name='( - + )',
last_name='', last_name='',
) )
self.tic() self.tic()
def beforeTearDown(self):
self.person_module.manage_delObjects(ids=list(tuple(self.person_module.objectIds())))
self.tic()
def test_full_text_searchable_text(self):
# check if 'é' == 'e' collation works # check if 'é' == 'e' collation works
result = person_module.searchFolder(SearchableText='Faure') result = self.person_module.searchFolder(SearchableText='Faure')
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person1.getPath()) self.assertEqual(result[0].getPath(), self.person1.getPath())
result = person_module.searchFolder(title='Faure')
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person1.getPath())
# check if a partial string of CJK string matches # check if a partial string of CJK string matches
result = person_module.searchFolder(SearchableText='武者') result = self.person_module.searchFolder(SearchableText='武者')
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), self.person2.getPath())
# check boolean language mode search
result = self.person_module.searchFolder(SearchableText='+quick +fox +dog')
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), self.person1.getPath())
# check sort on fulltext column
self.assertFalse('ORDER BY\n MATCH' in self.portal.portal_catalog(SearchableText='Faure', sort_on=(('SearchableText', 'ascending'),), src__=1))
# check sort on fulltext search score
self.assertTrue('ORDER BY\n MATCH' in self.portal.portal_catalog(SearchableText='Faure', sort_on=(('SearchableText__score__', 'ascending'),), src__=1))
def test_catalog_full_text_title(self):
# check if 'é' == 'e' collation works
result = self.person_module.searchFolder(**{'catalog_full_text.title':'Faure'})
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person2.getPath()) self.assertEqual(result[0].getPath(), self.person1.getPath())
result = person_module.searchFolder(title='武者')
# check if a partial string of CJK string matches
result = self.person_module.searchFolder(**{'catalog_full_text.title':'武者'})
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person2.getPath()) self.assertEqual(result[0].getPath(), self.person2.getPath())
# check boolean language mode search # check boolean language mode search
result = person_module.searchFolder(SearchableText='+quick +fox +dog') result = self.person_module.searchFolder(**{'catalog_full_text.description':'+quick +fox +dog'})
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person1.getPath()) self.assertEqual(result[0].getPath(), self.person1.getPath())
result = person_module.searchFolder(description='+quick +fox +dog')
# check search with a special character
for query in ('(', ')', ):
result = self.person_module.searchFolder(**{'catalog_full_text.title':query})
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), self.person3.getPath())
# check sort on fulltext column
self.assertFalse('ORDER BY\n MATCH' in self.portal.portal_catalog(**{
'catalog_full_text.title':'Faure',
'sort_on':(('catalog_full_text.title', 'ascending'),),
'src__':1
}))
# check sort on fulltext search score
self.assertFalse('ORDER BY\n MATCH' in self.portal.portal_catalog(**{
'catalog_full_text.title':'Faure',
'sort_on':(('catalog_full_text.title__score__', 'ascending'),),
'src__':1
}))
@expectedFailure
def test_full_text_title(self):
# check if 'é' == 'e' collation works
result = self.person_module.searchFolder(title='Faure')
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), self.person1.getPath())
# check if a partial string of CJK string matches
result = self.person_module.searchFolder(title='武者')
self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), self.person2.getPath())
# check boolean language mode search
result = self.person_module.searchFolder(description='+quick +fox +dog')
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person1.getPath()) self.assertEqual(result[0].getPath(), self.person1.getPath())
# check search with a special character # check search with a special character
for query in ('(', ')', ): for query in ('(', ')', ):
result = person_module.searchFolder(title=query) result = self.person_module.searchFolder(title=query)
self.assertEqual(len(result), 1) self.assertEqual(len(result), 1)
self.assertEqual(result[0].getPath(), person3.getPath()) self.assertEqual(result[0].getPath(), self.person3.getPath())
# check fulltext search for automatically generated related keys. # check fulltext search for automatically generated related keys.
self.assertTrue('MATCH' in self.portal.portal_catalog(destination_title='Faure', src__=1)) self.assertTrue('MATCH' in self.portal.portal_catalog(destination_title='Faure', src__=1))
......
...@@ -881,10 +881,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -881,10 +881,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
by looking at the category tree. by looking at the category tree.
For exemple it will generate: For exemple it will generate:
destination_reference | category,catalog/reference/z_related_destination destination_title | category,catalog/title/z_related_destination
default_destination_reference | category,catalog/reference/z_related_destination default_destination_title | category,catalog/title/z_related_destination
strict_destination_reference | category,catalog/reference/z_related_strict_destination strict_destination_title | category,catalog/title/z_related_strict_destination
destination_title | category,catalog_full_text/title/z_related_destination
strict_ related keys only returns documents which are strictly member of strict_ related keys only returns documents which are strictly member of
the category. the category.
...@@ -918,18 +917,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -918,18 +917,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
if related: if related:
end_key = end_key[len(related_string):] end_key = end_key[len(related_string):]
# XXX: joining with non-catalog tables is not trivial and requires # XXX: joining with non-catalog tables is not trivial and requires
# ZSQLCatalog's ColumnMapper cooperation, so only allow columns in # ZSQLCatalog's ColumnMapper cooperation, so only allow catalog
# catalog or catalog_full_text tables. # columns.
if end_key != 'uid' and 'catalog_full_text' in column_map.get(end_key, ()): if 'catalog' in column_map.get(end_key, ()):
related_key_list.append(
prefix + key + ' | category,catalog_full_text/' +
end_key +
'/z_related_' +
('strict_' if strict else '') +
expected_base_cat_id +
('_related' if related else '')
)
elif 'catalog' in column_map.get(end_key, ()):
is_uid = end_key == 'uid' is_uid = end_key == 'uid'
if is_uid: if is_uid:
end_key = 'uid' if related else 'category_uid' end_key = 'uid' if related else 'category_uid'
......
...@@ -1243,7 +1243,7 @@ class TestDocument(TestDocumentMixin): ...@@ -1243,7 +1243,7 @@ class TestDocument(TestDocumentMixin):
# should return all documents matching a word no matter of contributor # should return all documents matching a word no matter of contributor
self.assertSameSet([web_page_1, document_4], getAdvancedSearchStringResultList(**kw)) self.assertSameSet([web_page_1, document_4], getAdvancedSearchStringResultList(**kw))
kw = {'searchabletext_any': 'owner', kw = {'searchabletext_any': 'owner',
'contributor_title': 'Contributor'} 'contributor_title': '%Contributor%'}
self.assertSameSet([document_4], getAdvancedSearchStringResultList(**kw)) self.assertSameSet([document_4], getAdvancedSearchStringResultList(**kw))
# multiple portal_type specified # multiple portal_type specified
......
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