Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
7cfdac13
Commit
7cfdac13
authored
Sep 26, 2014
by
Tristan Cavelier
Committed by
Kazuhiko Shiozaki
Oct 31, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement fulltext search for title and description.
parent
108a61f4
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
603 additions
and
18 deletions
+603
-18
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
...p5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
+3
-2
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
...p5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
...al_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
+70
-0
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
...sql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
...talog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
+68
-0
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
...tal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
+16
-2
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
...5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
...l_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
+82
-0
bt5/erp5_full_text_mroonga_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
...atalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
+4
-0
bt5/erp5_full_text_mroonga_catalog/CatalogResultTableTemplateItem/result_table_list.xml
...alog/CatalogResultTableTemplateItem/result_table_list.xml
+1
-0
bt5/erp5_full_text_mroonga_catalog/CatalogSearchKeyTemplateItem/search_key_list.xml
..._catalog/CatalogSearchKeyTemplateItem/search_key_list.xml
+4
-0
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_method_id_list
...l_text_mroonga_catalog/bt/template_catalog_method_id_list
+3
-0
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_related_key_list
...text_mroonga_catalog/bt/template_catalog_related_key_list
+2
-0
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_result_table_list
...ext_mroonga_catalog/bt/template_catalog_result_table_list
+1
-0
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_search_key_list
..._text_mroonga_catalog/bt/template_catalog_search_key_list
+5
-1
bt5/erp5_full_text_myisam_catalog/CatalogFullTextKeyTemplateItem/full_text_key_list.xml
...log/CatalogFullTextKeyTemplateItem/full_text_key_list.xml
+5
-1
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
...p5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
+3
-2
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
...p5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
...al_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
+70
-0
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
...sql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
...talog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
+68
-0
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
...tal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
+16
-2
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
...5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
+5
-0
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
...l_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
+82
-0
bt5/erp5_full_text_myisam_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
...atalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
+4
-0
bt5/erp5_full_text_myisam_catalog/CatalogResultTableTemplateItem/result_table_list.xml
...alog/CatalogResultTableTemplateItem/result_table_list.xml
+1
-0
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_full_text_key_list
...ext_myisam_catalog/bt/template_catalog_full_text_key_list
+5
-1
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_method_id_list
...ll_text_myisam_catalog/bt/template_catalog_method_id_list
+3
-0
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_related_key_list
..._text_myisam_catalog/bt/template_catalog_related_key_list
+2
-0
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_result_table_list
...text_myisam_catalog/bt/template_catalog_result_table_list
+1
-0
product/ERP5/tests/testI18NSearch.py
product/ERP5/tests/testI18NSearch.py
+38
-1
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+16
-6
No files found.
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
View file @
7cfdac13
...
...
@@ -68,8 +68,9 @@ for path in path_list:\n
try:\n
tmp_dict = {}\n
for property in property_list:\n
if property == \'SearchableText\':\n
value = obj.SearchableText()\n
getter = getattr(obj, property, None)\n
if getter is not None and callable(getter):\n
value = getter()\n
else:\n
value = getattr(obj, \'get%s\' % UpperCase(property))()\n
tmp_dict[property] = value\n
...
...
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_clear_catalog"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_col
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z0_drop_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
DROP TABLE IF EXISTS catalog_full_text
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_uncatalog_object"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
uid
</string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_deferred_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z0_uncatalog_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM catalog_full_text WHERE <dtml-sqltest uid op=eq type=int>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
View file @
7cfdac13
...
...
@@ -15,7 +15,9 @@
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
uid\r\n
SearchableText
</string>
</value>
SearchableText\r\n
getTitle\r\n
getDescription
</string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
...
...
@@ -79,7 +81,19 @@ VALUES\n
)
<dtml-unless
sequence-end
>
,
</dtml-unless>
\n
</dtml-in>
\n
</dtml-if>
\n
</dtml-let>
</dtml-let>
\n
<dtml-var
sql_delimiter
>
\n
REPLACE INTO\n
catalog_full_text (`uid`, `title`, `description`)\n
VALUES\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
(\n
<dtml-sqlvar
expr=
"uid[loop_item]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"getTitle[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDescription[loop_item]"
type=
"string"
optional
>
\n
)
<dtml-unless
sequence-end
>
,
</dtml-unless>
\n
</dtml-in>
\n
]]>
</string>
</value>
</item>
...
...
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_clear_catalog"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_mroonga_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_col
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z_create_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
# Host:\n
# Database: test\n
# Table: \'catalog_full_text\'\n
#\n
CREATE TABLE `catalog_full_text` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`title` varchar(255) default \'\',\n
`description` text,\n
PRIMARY KEY (`uid`),\n
FULLTEXT `title` (`title`),\n
FULLTEXT `description` (`description`)\n
) ENGINE=mroonga;\n
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_mroonga_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
0 → 100644
View file @
7cfdac13
<key_list>
<key>
description | catalog_full_text/description/z_related_uid
</key>
<key>
title | catalog_full_text/title/z_related_uid
</key>
</key_list>
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/CatalogResultTableTemplateItem/result_table_list.xml
View file @
7cfdac13
<key_list>
<key>
catalog_full_text
</key>
<key>
full_text
</key>
</key_list>
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/CatalogSearchKeyTemplateItem/search_key_list.xml
View file @
7cfdac13
<key_list>
<key>
SearchableText | MroongaFullTextKey
</key>
<key>
catalog_full_text.description | MroongaFullTextKey
</key>
<key>
catalog_full_text.title | MroongaBooleanFullTextKey
</key>
<key>
description | MroongaFullTextKey
</key>
<key>
full_text.SearchableText | MroongaFullTextKey
</key>
<key>
title | MroongaBooleanFullTextKey
</key>
</key_list>
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_method_id_list
View file @
7cfdac13
erp5_mysql_innodb/SQLCatalog_deferFullTextIndex
erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity
erp5_mysql_innodb/SQLCatalog_makeFullTextQuery
erp5_mysql_innodb/z0_drop_catalog_fulltext
erp5_mysql_innodb/z0_drop_content_translation
erp5_mysql_innodb/z0_drop_fulltext
erp5_mysql_innodb/z0_uncatalog_catalog_fulltext
erp5_mysql_innodb/z0_uncatalog_fulltext
erp5_mysql_innodb/z_catalog_fulltext_list
erp5_mysql_innodb/z_create_catalog_fulltext
erp5_mysql_innodb/z_create_content_translation
erp5_mysql_innodb/z_create_fulltext
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_related_key_list
0 → 100644
View file @
7cfdac13
title | catalog_full_text/title/z_related_uid
description | catalog_full_text/description/z_related_uid
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_result_table_list
View file @
7cfdac13
catalog_full_text
full_text
\ No newline at end of file
bt5/erp5_full_text_mroonga_catalog/bt/template_catalog_search_key_list
View file @
7cfdac13
SearchableText | MroongaFullTextKey
full_text.SearchableText | MroongaFullTextKey
\ No newline at end of file
catalog_full_text.description | MroongaFullTextKey
catalog_full_text.title | MroongaBooleanFullTextKey
description | MroongaFullTextKey
full_text.SearchableText | MroongaFullTextKey
title | MroongaBooleanFullTextKey
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/CatalogFullTextKeyTemplateItem/full_text_key_list.xml
View file @
7cfdac13
<key_list>
<key>
SearchableText
</key>
<key>
full_text.SearchableText
</key>
<key>
catalog_full_text.description
</key>
<key>
catalog_full_text.title
</key>
|
<key>
description
</key>
|
<key>
full_text.SearchableText
</key>
|
<key>
title
</key>
|
</key_list>
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity.xml
View file @
7cfdac13
...
...
@@ -68,8 +68,9 @@ for path in path_list:\n
try:\n
tmp_dict = {}\n
for property in property_list:\n
if property == \'SearchableText\':\n
value = obj.SearchableText()\n
getter = getattr(obj, property, None)\n
if getter is not None and callable(getter):\n
value = getter()\n
else:\n
value = getattr(obj, \'get%s\' % UpperCase(property))()\n
tmp_dict[property] = value\n
...
...
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_clear_catalog"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_col
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z0_drop_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
DROP TABLE IF EXISTS catalog_full_text
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_uncatalog_object"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
uid
</string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_deferred_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z0_uncatalog_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM catalog_full_text WHERE <dtml-sqltest uid op=eq type=int>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_fulltext_list.xml
View file @
7cfdac13
...
...
@@ -15,7 +15,9 @@
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
uid\r\n
SearchableText
</string>
</value>
SearchableText\r\n
getTitle\r\n
getDescription
</string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
...
...
@@ -79,7 +81,19 @@ VALUES\n
)
<dtml-unless
sequence-end
>
,
</dtml-unless>
\n
</dtml-in>
\n
</dtml-if>
\n
</dtml-let>
</dtml-let>
\n
<dtml-var
sql_delimiter
>
\n
REPLACE INTO\n
catalog_full_text (`uid`, `title`, `description`)\n
VALUES\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
(\n
<dtml-sqlvar
expr=
"uid[loop_item]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"getTitle[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDescription[loop_item]"
type=
"string"
optional
>
\n
)
<dtml-unless
sequence-end
>
,
</dtml-unless>
\n
</dtml-in>
\n
]]>
</string>
</value>
</item>
...
...
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.catalog_keys.xml
0 → 100644
View file @
7cfdac13
<catalog_method>
<item
key=
"sql_clear_catalog"
type=
"int"
>
<value>
1
</value>
</item>
</catalog_method>
bt5/erp5_full_text_myisam_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_catalog_fulltext.xml
0 → 100644
View file @
7cfdac13
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_col
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
z_create_catalog_fulltext
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
# Host:\n
# Database: test\n
# Table: \'catalog_full_text\'\n
#\n
CREATE TABLE `catalog_full_text` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`title` varchar(255) default \'\',\n
`description` text,\n
PRIMARY KEY (`uid`),\n
FULLTEXT `title` (`title`),\n
FULLTEXT `description` (`description`)\n
) ENGINE=mroonga;\n
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_full_text_myisam_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
0 → 100644
View file @
7cfdac13
<key_list>
<key>
description | catalog_full_text/description/z_related_uid
</key>
<key>
title | catalog_full_text/title/z_related_uid
</key>
</key_list>
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/CatalogResultTableTemplateItem/result_table_list.xml
View file @
7cfdac13
<key_list>
<key>
catalog_full_text
</key>
<key>
full_text
</key>
</key_list>
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_full_text_key_list
View file @
7cfdac13
SearchableText
full_text.SearchableText
\ No newline at end of file
catalog_full_text.description
catalog_full_text.title
description
full_text.SearchableText
title
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_method_id_list
View file @
7cfdac13
erp5_mysql_innodb/SQLCatalog_deferFullTextIndex
erp5_mysql_innodb/SQLCatalog_deferFullTextIndexActivity
erp5_mysql_innodb/SQLCatalog_makeFullTextQuery
erp5_mysql_innodb/z0_drop_catalog_fulltext
erp5_mysql_innodb/z0_drop_content_translation
erp5_mysql_innodb/z0_drop_fulltext
erp5_mysql_innodb/z0_uncatalog_catalog_fulltext
erp5_mysql_innodb/z0_uncatalog_fulltext
erp5_mysql_innodb/z_catalog_fulltext_list
erp5_mysql_innodb/z_create_catalog_fulltext
erp5_mysql_innodb/z_create_content_translation
erp5_mysql_innodb/z_create_fulltext
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_related_key_list
0 → 100644
View file @
7cfdac13
title | catalog_full_text/title/z_related_uid
description | catalog_full_text/description/z_related_uid
\ No newline at end of file
bt5/erp5_full_text_myisam_catalog/bt/template_catalog_result_table_list
View file @
7cfdac13
catalog_full_text
full_text
\ No newline at end of file
product/ERP5/tests/testI18NSearch.py
View file @
7cfdac13
...
...
@@ -43,21 +43,58 @@ class TestI18NSearch(ERP5TypeTestCase):
portal_type
=
'Person'
,
first_name
=
'Gabriel'
,
last_name
=
'Fauré'
,
description
=
'Quick brown fox jumps over the lazy dog.'
,
)
person2
=
person_module
.
newContent
(
portal_type
=
'Person'
,
first_name
=
'武者小路'
,
last_name
=
'実篤'
last_name
=
'実篤'
,
description
=
'Slow white fox jumps over the diligent dog.'
,
)
self
.
tic
()
# check if 'é' == 'e' collation works
result
=
person_module
.
searchFolder
(
SearchableText
=
'Faure'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
getPath
(),
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
result
=
person_module
.
searchFolder
(
SearchableText
=
'武者'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
getPath
(),
person2
.
getPath
())
result
=
person_module
.
searchFolder
(
title
=
'武者'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
getPath
(),
person2
.
getPath
())
# check natural language mode search
result
=
person_module
.
searchFolder
(
SearchableText
=
'quick fox dog'
)
self
.
assertEqual
(
len
(
result
),
2
)
sorted_result
=
sorted
(
list
(
result
),
key
=
lambda
x
:
x
.
SearchableText
,
reverse
=
True
)
# all of 'quick', 'fox' and 'dog' match.
self
.
assertEqual
(
result
[
0
].
getPath
(),
person1
.
getPath
())
# only 'fox' and 'dog' match.
self
.
assertEqual
(
result
[
1
].
getPath
(),
person2
.
getPath
())
result
=
person_module
.
searchFolder
(
description
=
'quick fox dog'
)
self
.
assertEqual
(
len
(
result
),
2
)
sorted_result
=
sorted
(
list
(
result
),
key
=
lambda
x
:
x
.
description
,
reverse
=
True
)
# all of 'quick', 'fox' and 'dog' match.
self
.
assertEqual
(
result
[
0
].
getPath
(),
person1
.
getPath
())
# only 'fox' and 'dog' match.
self
.
assertEqual
(
result
[
1
].
getPath
(),
person2
.
getPath
())
# check boolean language mode search
result
=
person_module
.
searchFolder
(
SearchableText
=
'+quick +fox +dog'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
getPath
(),
person1
.
getPath
())
result
=
person_module
.
searchFolder
(
description
=
'+quick +fox +dog'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
getPath
(),
person1
.
getPath
())
# check fulltext search for automatically generated related keys.
self
.
assertTrue
(
'MATCH'
in
self
.
portal
.
portal_catalog
(
destination_title
=
'Faure'
,
src__
=
1
))
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
product/ERP5Catalog/CatalogTool.py
View file @
7cfdac13
...
...
@@ -881,9 +881,10 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
by looking at the category tree.
For exemple it will generate:
destination_title | category,catalog/title/z_related_destination
default_destination_title | category,catalog/title/z_related_destination
strict_destination_title | category,catalog/title/z_related_strict_destination
destination_reference | category,catalog/reference/z_related_destination
default_destination_reference | category,catalog/reference/z_related_destination
strict_destination_reference | category,catalog/reference/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
the category.
...
...
@@ -917,9 +918,18 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
if
related
:
end_key
=
end_key
[
len
(
related_string
):]
# XXX: joining with non-catalog tables is not trivial and requires
# ZSQLCatalog's ColumnMapper cooperation, so only allow catalog
# columns.
if
'catalog'
in
column_map
.
get
(
end_key
,
()):
# ZSQLCatalog's ColumnMapper cooperation, so only allow columns in
# catalog or catalog_full_text tables.
if
end_key
!=
'uid'
and
'catalog_full_text'
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'
if
is_uid
:
end_key
=
'uid'
if
related
else
'category_uid'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment