Commit 454138a3 authored by Ivan Tyagov's avatar Ivan Tyagov

Define Sphinx's full_text key implementation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42736 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 85ab0fb6
......@@ -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>
......
<key_list>
<key>full_text | SQLCatalog_makeFullTextQuery</key>
</key_list>
\ No newline at end of file
<?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>
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.
......
15
\ No newline at end of file
18
\ No newline at end of file
full_text | SQLCatalog_makeFullTextQuery
\ No newline at end of file
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