This repository shows the integration of Sphinx into a Zend Framework application. It is a reference implementation accompanying a series of posts about Sphinx and SphinxSE on my blog.
The application contains a sample configuration file for Sphinx. It shows that the file can be processed by a scripting language (PHP here of course) and utilizes Zend_Application for fetching global options (like database credentials) from application.ini.
Jsor_Paginator_Adapter_DbSelectSphinxSe implements a Zend_Paginator adapter using SpinxSE.
The IndexController shows a example usage of the adapter.
The application provides a script for starting, stopping and restarting the Sphinx daemon and for starting the indexer.
This is not a production-ready application!
You must have installed Sphinx 0.9.9+ with SphinxSE.
The application is not packaged with the Zend Framework. Prior to use, you should ensure Zend Framework 1.9.7+ is available from your include_path.
You can either copy/link it to the libary folder or install it via PEAR.
The (unofficial) PEAR Channel can be found at http://pear.zfcampus.org.
In line with recent Zend Framework versions, PHP 5.2.6 is the lowest supported version supported though it is strongly recommended the latest PHP version be used.
-
Install Zend Framework to your include_path as described above.
-
Copy the application to your destination of choice and ensure any intended Virtual Host is pointing to the
publicdirectory as the Host's document root. Thedatadirectory should be writeable from PHP. -
Copy or rename the
application/configs/application.ini-disttoapplication/configs/application.ini. -
Create a new database (and optionally user). Edit the
application/configs/application.inito reflect these details. -
Import the dump from
data/sphinx_example.sqlto the database. -
Use
scripts/sphinxto create the search index and start the search daemon:$ ./scripts/sphinx index-all $ ./scripts/sphinx start -
Point your browser to http://your-vhost/ to see a basic example search form.