.

Sphinx

Database driver for the Sphinx full text search engine (http://www.sphinxsearch.com/). More...

Classes

class   DataObjectSphinxBase
  A DataObject class for Sphinx indexes. More...
class   DBDriverSphinx
  DB Driver for Sphinx full text index. More...
class   DBResultSetCountSphinx
  Result set for Sphinx count queries. More...
class   DBResultSetSphinx
  Result set for Sphinx. More...
class   DBSqlBuilderCountSphinx
  Count Query Builder for Sphinx. More...
class   DBSqlBuilderDeleteSphinx
  Delete Query Builder for Sphinx. More...
class   DBSqlBuilderInsertSphinx
  Insert Query Builder for Sphinx. More...
class   DBSqlBuilderSelectSphinx
  Select Query Builder for Sphinx. More...
class   DBSqlBuilderSReplaceSphinx
  Replace Query Builder for Sphinx. More...
class   DBSqlBuilderUpdateSphinx
  Update Query Builder for Sphinx. More...
class   DBSqlBuilderWhereGroupSphinx
  Where Group Query Builder for Sphinx. More...
class   DBSqlBuilderWhereSphinx
  Where Clause Query Builder for Sphinx. More...
class   SphinxIndexRotateCommand
  Rotates (reindex) given index. More...

Detailed Description

Database driver for the Sphinx full text search engine (http://www.sphinxsearch.com/).

Usage

To use the Sphinx full text index, you may continue using the data access objects as you are used to be. Your DAO instance should be derived from DataObjectSphinx, though.

When declaring your table object, pass the Sphinx driver name, like so:

 protected function create_table_object()  {
   return new DBTable(
     '{indexname}',
     array(
       ... index fields ...
     ),
     {primary key}
     array(),
     array(),
     DBDriverSphinx::DEFAULT_CONNECTION_NAME
   );
 }

In your config, define these constants:

  • APP_SPHINX_DB_HOST: both host and (optional) port of your sphinx daemon. If you ommit the port, Sphinx default port 9312 is used. This constant is optional, default value is "localhost"
  • APP_SPHINX_DB_NAME: A string that gets prefixed to all index names
  • APP_SPHINX_INDEXER_INVOKE: Path and optional arguments to the sphinx indexer, e.g '/usr/local/bin/indexer -c /path/to/sphinx.conf');
  • APP_SPHINX_MAX_MATCHES: Value of the max_matches config option (optional, 1,000 by default)

Features

This module supports querying by full text fields and by attributes. If you want to full text search over all indexed fields, use the property "sphinx_all_fields":

 $dao = .. create DAO for index ..
 $dao->sphinx_all_fields = 'search term';

You may also use the wildcard instead:

 $dao = .. create DAO for index ..
 $dao->add_where('*', '=', 'search term');

Sphinx virtual columns are available for sorting or filtering:

 public function get_sortable_columns() {
   return array(
     'relevance' => new DBSortColumn('@relevance', tr('Relevance'), DBSortColumn::TYPE_MATCH, DBSortColumn::ORDER_FORWARD, true),
     'title' => new DBSortColumn('title', tr('Title'), DBSortColumn::TYPE_TEXT)
   );
 }

Additional notes

This module is build against version 0.9.9 of Sphinx. You may download it here: http://www.sphinxsearch.com/downloads.html

Sphinx is publicly distributed under GNU General Public License (GPL), version 2.