From 454138a3d2e96db0392c1fdbc2e135dd723796d3 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 28 Jan 2011 11:34:55 +0000
Subject: [PATCH] Define Sphinx's full_text key implementation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42736 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../SQLCatalog_makeFullTextQuery.xml          | 11 +--
 .../scriptable_key_list.xml                   |  3 -
 .../ERP5Site_viewQuickSearchResultList.xml    | 95 -------------------
 .../bt/change_log                             |  3 +
 .../bt/revision                               |  2 +-
 .../bt/template_catalog_scriptable_key_list   |  1 -
 6 files changed, 9 insertions(+), 106 deletions(-)
 delete mode 100644 bt5/erp5_full_text_sphinxse_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
 delete mode 100644 bt5/erp5_full_text_sphinxse_catalog/SkinTemplateItem/portal_skins/erp5_sphinxse/ERP5Site_viewQuickSearchResultList.xml
 delete mode 100644 bt5/erp5_full_text_sphinxse_catalog/bt/template_catalog_scriptable_key_list

diff --git a/bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeFullTextQuery.xml b/bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeFullTextQuery.xml
index 4ef490a377..1d93f5220b 100644
--- a/bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeFullTextQuery.xml
+++ b/bt5/erp5_full_text_sphinxse_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeFullTextQuery.xml
@@ -50,13 +50,12 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query\n
+            <value> <string>"""\n
+  Sphinx full text searchable key implementation.\n
+"""\n
+from Products.ZSQLCatalog.SQLCatalog import Query\n
 \n
-# XXX Should we use system preference here?\n
-if \'sphinxse_index\' in container.getCatalogSearchTableIds():\n
-  query = Query(**{\'sphinxse_query\':value})\n
-else:\n
-  query = Query(**{\'full_text.SearchableText\':value})\n
+query = Query(**{\'sphinxse_query\': value})\n
 return query\n
 </string> </value>
         </item>
diff --git a/bt5/erp5_full_text_sphinxse_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml b/bt5/erp5_full_text_sphinxse_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
deleted file mode 100644
index 3220820318..0000000000
--- a/bt5/erp5_full_text_sphinxse_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<key_list>
- <key>full_text | SQLCatalog_makeFullTextQuery</key>
-</key_list>
\ No newline at end of file
diff --git a/bt5/erp5_full_text_sphinxse_catalog/SkinTemplateItem/portal_skins/erp5_sphinxse/ERP5Site_viewQuickSearchResultList.xml b/bt5/erp5_full_text_sphinxse_catalog/SkinTemplateItem/portal_skins/erp5_sphinxse/ERP5Site_viewQuickSearchResultList.xml
deleted file mode 100644
index e18bdbf4b1..0000000000
--- a/bt5/erp5_full_text_sphinxse_catalog/SkinTemplateItem/portal_skins/erp5_sphinxse/ERP5Site_viewQuickSearchResultList.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>kw = {\'reset\':1,\n
-      \'full_text\':field_your_search_text,\n
-      \'your_search_text\':field_your_search_text,\n
-      \'all_languages\':all_languages,\n
-      \'ignore_hide_rows\': 1,\n
-      \'list_style\':list_style}\n
-\n
-if field_your_search_portal_type:\n
-  if field_your_search_portal_type == \'all\':\n
-    kw.update({\'portal_type\':list(context.getPortalDocumentTypeList())})\n
-  else:\n
-    kw.update({\'portal_type\':field_your_search_portal_type})\n
-\n
-web_section = context.getWebSectionValue()\n
-if web_section is not None and \\\n
-    not bool(context.REQUEST.get(\'ignore_layout\', False)):\n
-  search_context = web_section\n
-  if list_style is None:\n
-    kw.update({\'list_style\':\'search\'})\n
-else:\n
-  search_context = context.getPortalObject()\n
-\n
-if field_your_search_text in (\'\', None):\n
-  # no search criteria specified, refuse to conduct any search and \n
-  # show a message to user\n
-  kw[\'portal_status_message\'] = \'Please specify search criteria.\'\n
-  return search_context.Base_redirect(\'view\', keep_items=kw)\n
-  \n
-return search_context.Base_redirect(field_your_search_form_id, keep_items=kw)\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>field_your_search_text=\'\', field_your_search_portal_type=\'\', all_languages=None, list_style=None, field_your_search_form_id=\'ERP5Site_viewSearchResult\'</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>ERP5Site_viewQuickSearchResultList</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_full_text_sphinxse_catalog/bt/change_log b/bt5/erp5_full_text_sphinxse_catalog/bt/change_log
index c1550f4549..1ad44edfde 100644
--- a/bt5/erp5_full_text_sphinxse_catalog/bt/change_log
+++ b/bt5/erp5_full_text_sphinxse_catalog/bt/change_log
@@ -1,3 +1,6 @@
+2011-01-28 Ivan
+* Define Sphinx's full_text key implementation.
+
 2011-01-03 Kazuhiko
 * retrieve SearchableText from catalog, not calling SearchableText method.
 * Use InnoDB with non-deferred connection for full_text table, because we don't need fulltext search function of transactionless MyISAM engine.
diff --git a/bt5/erp5_full_text_sphinxse_catalog/bt/revision b/bt5/erp5_full_text_sphinxse_catalog/bt/revision
index 3f10ffe7a4..25bf17fc5a 100644
--- a/bt5/erp5_full_text_sphinxse_catalog/bt/revision
+++ b/bt5/erp5_full_text_sphinxse_catalog/bt/revision
@@ -1 +1 @@
-15
\ No newline at end of file
+18
\ No newline at end of file
diff --git a/bt5/erp5_full_text_sphinxse_catalog/bt/template_catalog_scriptable_key_list b/bt5/erp5_full_text_sphinxse_catalog/bt/template_catalog_scriptable_key_list
deleted file mode 100644
index d0aa506d26..0000000000
--- a/bt5/erp5_full_text_sphinxse_catalog/bt/template_catalog_scriptable_key_list
+++ /dev/null
@@ -1 +0,0 @@
-full_text | SQLCatalog_makeFullTextQuery
\ No newline at end of file
-- 
2.30.9