How To Use Sphinx Search Engine
Overview
Sphinx search engine is an open source full-text search engine. It supports:
- real-time indexing
stemming for various languages using Snowball.
How to use
To use Sphinx search engine in ERP5, you need to to the followings:
- create 'Z MySQL Database Connection' object.
- configure portal_catalog property (optional).
- install erp5_full_text_sphinxse_catalog business template.
create 'Z MySQL Database Connection' object in your ERP5 portal folder using ZMI
First, Go to your ERP5 portal folder with ZMI (eg. /erp5/manage_main). Then add a 'Z MySQL Database Connection' object like the following:
- Id
- sphinx_sql_connection
- Database Connection String
dummy@127.0.0.1:9306
Here, we don't care 'database' parameter. Modify 'host' and 'port' part according to your environment. 127.0.0.1:9306 is the default of our buildout environment.
configure portal_catalog property (optional)
By default, the name of the Sphinx search engine database is 'erp5'. If you want to use a different database name, go to property management screen of your catalog (eg. /erp5/portal_catalog/erp5_mysql_innodb/manage_propertiesForm) and add a new property like the following:
- Name
- sphinx_index
- Type
- string
- Value
- your_database_name
install erp5_full_text_sphinxse_catalog business template
Now install erp5_full_text_sphinxse_catalog business template. Find inside portal_catalog/erp5_mysql_innodb z_catalog_sphinxse_index_list and z0_uncatalog_sphinxse_index and make sure they use already created before sphinx_sql_connection which is open.
Reindex the site with clear_catalog.
Tips
I want to recreate Sphinx search engine index without reindexing everything in MySQL
You can invoke 'ERP5Site_reindexSphinxSE' script, that reads full_text data from MySQL's full_text table and index them in Sphinx search engine.