Commit 44e65923 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

full text: not DELETE many and INSERT some, but REPLACE some and DELETE others.

also update catalog_full_text table synchronously with a deferred connection.
parent f14ee65a
<catalog_method>
<item key="sql_catalog_object_list" type="int">
<value>1</value>
</item>
</catalog_method>
<?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\r\n
getTitle\r\n
getDescription</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>z_catalog_catalog_fulltext_list</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[
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>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
<item> <item>
<key> <string>arguments_src</string> </key> <key> <string>arguments_src</string> </key>
<value> <string>uid\r\n <value> <string>uid\r\n
SearchableText\r\n SearchableText</string> </value>
getTitle\r\n
getDescription</string> </value>
</item> </item>
<item> <item>
<key> <string>cache_time_</string> </key> <key> <string>cache_time_</string> </key>
...@@ -57,21 +55,16 @@ getDescription</string> </value> ...@@ -57,21 +55,16 @@ getDescription</string> </value>
<key> <string>src</string> </key> <key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
DELETE FROM\n <dtml-let document_list="[]" delete_list="[]">\n
full_text\n
WHERE\n
<dtml-in uid>\n
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>\n
;\n
<dtml-var "\'\\0\'"><dtml-let document_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "SearchableText[loop_item]">\n <dtml-if "SearchableText[loop_item]">\n
<dtml-call expr="document_list.append(loop_item)">\n <dtml-call expr="document_list.append(loop_item)">\n
<dtml-else>\n
<dtml-call expr="delete_list.append(loop_item)">\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if expr="_.len(document_list) > 0">\n <dtml-if expr="_.len(document_list) > 0">\n
INSERT INTO\n REPLACE INTO\n
full_text\n full_text\n
VALUES\n VALUES\n
<dtml-in prefix="loop" expr="document_list">\n <dtml-in prefix="loop" expr="document_list">\n
...@@ -81,18 +74,18 @@ VALUES\n ...@@ -81,18 +74,18 @@ VALUES\n
)<dtml-unless sequence-end>,</dtml-unless>\n )<dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
</dtml-let>\n <dtml-if expr="_.len(delete_list) > 0">\n
<dtml-var sql_delimiter>\n <dtml-var sql_delimiter>\n
REPLACE INTO\n DELETE FROM\n
catalog_full_text (`uid`, `title`, `description`)\n full_text\n
VALUES\n WHERE uid IN\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n ( \n
(\n <dtml-in prefix="loop" expr="delete_list">\n
<dtml-sqlvar expr="uid[loop_item]" type="int">, \n <dtml-sqlvar expr="uid[loop_item]" type="int"><dtml-unless sequence-end>,</dtml-unless>\n
<dtml-sqlvar expr="getTitle[loop_item]" type="string" optional>,\n </dtml-in>\n
<dtml-sqlvar expr="getDescription[loop_item]" type="string" optional>\n )\n
)<dtml-unless sequence-end>,</dtml-unless>\n </dtml-if>\n
</dtml-in>\n </dtml-let>\n
]]></string> </value> ]]></string> </value>
......
...@@ -6,6 +6,7 @@ erp5_mysql_innodb/z0_drop_content_translation ...@@ -6,6 +6,7 @@ erp5_mysql_innodb/z0_drop_content_translation
erp5_mysql_innodb/z0_drop_fulltext erp5_mysql_innodb/z0_drop_fulltext
erp5_mysql_innodb/z0_uncatalog_catalog_fulltext erp5_mysql_innodb/z0_uncatalog_catalog_fulltext
erp5_mysql_innodb/z0_uncatalog_fulltext erp5_mysql_innodb/z0_uncatalog_fulltext
erp5_mysql_innodb/z_catalog_catalog_fulltext_list
erp5_mysql_innodb/z_catalog_fulltext_list erp5_mysql_innodb/z_catalog_fulltext_list
erp5_mysql_innodb/z_create_catalog_fulltext erp5_mysql_innodb/z_create_catalog_fulltext
erp5_mysql_innodb/z_create_content_translation erp5_mysql_innodb/z_create_content_translation
......
<catalog_method>
<item key="sql_catalog_object_list" type="int">
<value>1</value>
</item>
</catalog_method>
<?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\r\n
getTitle\r\n
getDescription</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>z_catalog_catalog_fulltext_list</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[
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>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
<item> <item>
<key> <string>arguments_src</string> </key> <key> <string>arguments_src</string> </key>
<value> <string>uid\r\n <value> <string>uid\r\n
SearchableText\r\n SearchableText</string> </value>
getTitle\r\n
getDescription</string> </value>
</item> </item>
<item> <item>
<key> <string>cache_time_</string> </key> <key> <string>cache_time_</string> </key>
...@@ -57,21 +55,16 @@ getDescription</string> </value> ...@@ -57,21 +55,16 @@ getDescription</string> </value>
<key> <string>src</string> </key> <key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
DELETE FROM\n <dtml-let document_list="[]" delete_list="[]">\n
full_text\n
WHERE\n
<dtml-in uid>\n
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>\n
;\n
<dtml-var "\'\\0\'"><dtml-let document_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "SearchableText[loop_item]">\n <dtml-if "SearchableText[loop_item]">\n
<dtml-call expr="document_list.append(loop_item)">\n <dtml-call expr="document_list.append(loop_item)">\n
<dtml-else>\n
<dtml-call expr="delete_list.append(loop_item)">\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if expr="_.len(document_list) > 0">\n <dtml-if expr="_.len(document_list) > 0">\n
INSERT INTO\n REPLACE INTO\n
full_text\n full_text\n
VALUES\n VALUES\n
<dtml-in prefix="loop" expr="document_list">\n <dtml-in prefix="loop" expr="document_list">\n
...@@ -81,18 +74,18 @@ VALUES\n ...@@ -81,18 +74,18 @@ VALUES\n
)<dtml-unless sequence-end>,</dtml-unless>\n )<dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
</dtml-let>\n <dtml-if expr="_.len(delete_list) > 0">\n
<dtml-var sql_delimiter>\n <dtml-var sql_delimiter>\n
REPLACE INTO\n DELETE FROM\n
catalog_full_text (`uid`, `title`, `description`)\n full_text\n
VALUES\n WHERE uid IN\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n ( \n
(\n <dtml-in prefix="loop" expr="delete_list">\n
<dtml-sqlvar expr="uid[loop_item]" type="int">, \n <dtml-sqlvar expr="uid[loop_item]" type="int"><dtml-unless sequence-end>,</dtml-unless>\n
<dtml-sqlvar expr="getTitle[loop_item]" type="string" optional>,\n </dtml-in>\n
<dtml-sqlvar expr="getDescription[loop_item]" type="string" optional>\n )\n
)<dtml-unless sequence-end>,</dtml-unless>\n </dtml-if>\n
</dtml-in>\n </dtml-let>\n
]]></string> </value> ]]></string> </value>
......
...@@ -6,6 +6,7 @@ erp5_mysql_innodb/z0_drop_content_translation ...@@ -6,6 +6,7 @@ erp5_mysql_innodb/z0_drop_content_translation
erp5_mysql_innodb/z0_drop_fulltext erp5_mysql_innodb/z0_drop_fulltext
erp5_mysql_innodb/z0_uncatalog_catalog_fulltext erp5_mysql_innodb/z0_uncatalog_catalog_fulltext
erp5_mysql_innodb/z0_uncatalog_fulltext erp5_mysql_innodb/z0_uncatalog_fulltext
erp5_mysql_innodb/z_catalog_catalog_fulltext_list
erp5_mysql_innodb/z_catalog_fulltext_list erp5_mysql_innodb/z_catalog_fulltext_list
erp5_mysql_innodb/z_create_catalog_fulltext erp5_mysql_innodb/z_create_catalog_fulltext
erp5_mysql_innodb/z_create_content_translation erp5_mysql_innodb/z_create_content_translation
......
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