diff --git a/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/ERP5Site_getPersonMapAndUidList.xml b/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/ERP5Site_getPersonMapAndUidList.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7f967d7eb60fb8d2490fe981d1578df8ec1803d --- /dev/null +++ b/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/ERP5Site_getPersonMapAndUidList.xml @@ -0,0 +1,87 @@ +<?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>"""\n + Examine ERP5 Site return mapping between a \'reference\' and respective Person object\'s title.\n + This script is used in "No ZODB" approach to get fast search results.\n +"""\n +from Products.ERP5Type.Cache import CachingMethod\n +\n +def getPersonMapAndUidList():\n + result_dict = {}\n + kw[\'portal_type\'] = \'Person\'\n + kw[\'reference\'] = \'!=Null\'\n + person_list = context.portal_catalog(**kw)\n + for person in person_list:\n + person = person.getObject()\n + result_dict[person.getReference()] = {\'title\': person.getTitle(), \n + \'path\': person.getPath()}\n + return result_dict\n +\n +getPersonMapAndUidList = CachingMethod(getPersonMapAndUidList,\n + id = \'ERP5Site_getPersonMapAndUidList\',\n + cache_factory = \'erp5_content_medium\')\n +return getPersonMapAndUidList()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>**kw</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_getPersonMapAndUidList</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/WebSite_zGetAdvancedSearchResultList.xml b/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/WebSite_zGetAdvancedSearchResultList.xml index ae23ff9ea13d9d25f4214bd4bdae3b13999a5aa2..a53e7229ab300d7311a21463bf7016279e0559ac 100644 --- a/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/WebSite_zGetAdvancedSearchResultList.xml +++ b/bt5/erp5_km_sphinxse_full_text_search/SkinTemplateItem/portal_skins/erp5_km_sphinxse_full_text_search/WebSite_zGetAdvancedSearchResultList.xml @@ -87,10 +87,10 @@ SELECT catalog.uid, \n catalog.reference, \n catalog.modification_date,\n catalog.owner,\n - <dtml-if is_full_text_search_on> text, </dtml-if>\n - category_uid,\n - base_category_uid,\n - category_relative_url,\n + <dtml-if is_full_text_search_on> search_results.text, </dtml-if>\n + join_category.category_uid,\n + join_category.base_category_uid,\n + join_category.category_relative_url,\n versioning.version,\n versioning.language\n \n @@ -100,10 +100,10 @@ FROM catalog,\n <dtml-if is_full_text_search_on>\n <dtml-if use_text_excerpts>\n /* MySQL server can produc text excerpts */\n - , sphinx_snippets(full_text.SearchableText, \'erp5\', \'<dtml-var "search_string">\') as text\n + , sphinx_snippets(full_text.SearchableText, \'erp5\', \'<dtml-var "search_string">\') AS text\n <dtml-else>\n /* Return all searchable text to server which will extract found text excerpts */\n - , full_text.SearchableText as text\n + , full_text.SearchableText AS text\n </dtml-if>\n </dtml-if>\n <dtml-if "query[\'select_expression\']">\n @@ -125,13 +125,13 @@ FROM catalog,\n <dtml-else> LIMIT 1000 </dtml-if>) \n \n AS search_results LEFT JOIN \n - (SELECT category.uid as join_category_uid, \n + (SELECT category.uid AS join_category_uid, \n category.base_category_uid AS base_category_uid,\n category.category_uid AS category_uid,\n - catalog.relative_url as category_relative_url\n + catalog.relative_url AS category_relative_url\n FROM category, catalog\n WHERE category.category_strict_membership = 1\n - and category.base_category_uid in \n + AND category.base_category_uid IN \n (<dtml-in prefix="loop" expr="base_category_uid_list">\n <dtml-if sequence-end>\n <dtml-sqlvar expr="loop_item" type="int">\n @@ -139,12 +139,12 @@ FROM catalog,\n <dtml-sqlvar expr="loop_item" type="int">,\n </dtml-if>\n </dtml-in>)\n - and category.category_uid = catalog.uid\n + AND category.category_uid = catalog.uid\n \n ) AS join_category\n ON search_results.uid = join_category.join_category_uid\n \n -WHERE search_results.uid = catalog.uid and versioning.uid = catalog.uid\n +WHERE search_results.uid = catalog.uid AND versioning.uid = catalog.uid\n \n </dtml-let> diff --git a/bt5/erp5_km_sphinxse_full_text_search/bt/revision b/bt5/erp5_km_sphinxse_full_text_search/bt/revision index ca7bf83ac53a27a2a914bed25e1a07478dd8ef47..da2d3988d7d1a255376770b1e87394ebb42febb3 100644 --- a/bt5/erp5_km_sphinxse_full_text_search/bt/revision +++ b/bt5/erp5_km_sphinxse_full_text_search/bt/revision @@ -1 +1 @@ -13 \ No newline at end of file +14 \ No newline at end of file