Joomla Sphinx Search component tutorial
Step 2 – Configure Sphinx
Download and extract the component to a temporary directory. This directory should not be web-accessible, so you should not use the components folder.
Make sure to adjust all sphinx.conf values to suit your setup:
- Set correct database, username, and password for your Joomla database for each index
- Update table names in SQL queries if your Joomla installation uses different prefix
- Update the file paths (/www/joomla/sphinx/data/…, /www/joomla/sphinx/log/…) and create folders as necessary
Step 3 – Run Sphinx indexer
Run the sphinx indexer to prepare for searching:
/path/to/sphinx/installation/bin/indexer --config /path/to/sphinx.conf --all
Step 4 – Test the Sphinx search
When the indexer is finished, test that sphinx searching is actually working:
/path/to/sphinx/installation/bin/search --config /path/to/sphinx.conf "joomla"
Step 5 – Start Sphinx daemon
/path/to/sphinx/installation/bin/searchd --config /path/to/sphinx.conf
In order to start Start Sphinx Search at boot, do the following:
- write a script with following content:
#!/usr/bin/bash /path/to/sphinx/installation/bin/searchd --config /path/to/sphinx.conf
- put it in the /etc/init.d/ directory. Lets say you called it joomla_sphinx
- make the file you created, joomla_sphinx, executable, using:
chmod +x joomla_sphinx
In Debian based systems i.e. Ubuntu:
update-rc.d joomla_sphinx defaults
In Redhat based systems i.e. Fedora:
chkconfig --add joomla_sphinx
In windows based systems:
searchd.exe --install --config C:\Sphinx\sphinx.conf --servicename SphinxSearch
Step 6 – Setup scheduled jobs
To keep the index for the search engine up to date, the indexer must be scheduled to run at a regular interval. On most UNIX systems edit your crontab file by running the command:
Add this line to set up a cron job for the full index – for example once every night:
0 3 * * * /path/to/sphinx/indexer --q --c /path/to/sphinx.conf joomla_search --rotate >/dev/null
Make sure to adjust the paths to suit your configuration. Note that –rotate option is needed if searchd daemon is already running, so that the indexer does not modify the index file while it is being used.
It creates a new file and copies it over the existing one when it is done.
Now you should decide what do you need: Sphinx Search component, plugins or both.
Component will allow you to use customized search results page with customized search form.
Plugins will allow you to replace standard search engine by Sphinx Search engine for each type of Joomla content.
If you need only plugins then go to step 10 otherwise continue reading from step 7.
Step 7 – Install Sphinx Search component
Sphinx Search is easily installed as any Joomla component. That should be done via your site’s backend.
Once you log in, you should open the Extensions ⇒ Install/Unistall section and click on the [Browse..] button in the Upload Package File section. Navigate to the same Sphinx Search file you have downloaded earlier (com_sphinxsearch_latest.zip) and select it. Then click on the [Upload File & Install] button to start the installation. It will install Sphinx Search component.
Make sure that file /path/to/joomla/administration/com_sphinxsearch/configuration.php is readable and writeable by web server.
Step 8 – Setup Sphinx Search connection parameters
Open Components ⇒ Sphinx Search ⇒ Configuration and setup sphinx connection parameters and index name if necessary.
Step 9 – Test Sphinx Search component
Open //yousite.com/index.php/component/sphinxsearch/?q=performance and happy searching!
Step 10 – Setup Sphinx Search plugins
During component installation 6 additional Sphinx Search plugins were installed.
Those plugins support search by following types of content:
To enable plugins go to Joomla backend → Extension → Plugin Manager and select the type ‘Search’ into the dropdown list. There you will see recently installed Sphinx Search plugins.
Click on the plugin name to specify sphinx search settings and enable the plugin which you would like to use. Note that each plugin have separated configuration page.
Step 11 – Disable Standard Search plugins
Disable corresponding plugins for the standard search component:
Step 12 – Test Sphinx Search plugins
If you activated plugins for Content, Newsfeed and Contacts then standard Joomla search form will looks like: