.

DataObjectSphinxBase Class Reference
[Sphinx]

A DataObject class for Sphinx indexes. More...

Inheritance diagram for DataObjectSphinxBase:
DataObjectBase IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder DataObjectSearchIndexSphinxBase DAOSearchindex

List of all members.

Public Member Functions

  count_pager ()
  Return a count suitable for pagers.
  get_sphinx_feature ($name)
  Get a sphinx feature.
  index_rotate ()
  Reindex.
  set_sphinx_feature ($name, $value)
  Set a sphinx feature.

Public Attributes

  $sphinx_all_fields = ''
  $sphinx_features = array()

Protected Member Functions

  configure_select_query ($query, $policy)
  Configure a select query.

Detailed Description

A DataObject class for Sphinx indexes.

Author:
Gerd Riesselmann

Definition at line 8 of file dataobjectsphinx.base.cls.php.


Member Function Documentation

DataObjectSphinxBase::configure_select_query ( query,
policy  
) [protected]

Configure a select query.

Parameters:
DBQuerySelect  $query
int  $policy

Reimplemented from DataObjectBase.

Reimplemented in DataObjectSearchIndexSphinxBase.

Definition at line 28 of file dataobjectsphinx.base.cls.php.

00028                                                                    {
00029         parent::configure_select_query($query, $policy);
00030         if (!empty($this->sphinx_all_fields)) {
00031                         $query->add_where('*', '=', $this->sphinx_all_fields);                  
00032         }
00033         $query->sphinx_features = $this->sphinx_features;
00034         }       
DataObjectSphinxBase::count_pager (  ) 

Return a count suitable for pagers.

Sphinx will return a limited number of results, usually 1,000, regardless of the number of matches. This is defined by the configuration setting "max_matches" in the server config file.

This means limiting a result to - say - items 1,100 to 1,110 will result in an error, and due to the Gyro way of dealing with DB error will raise an exception.

Therefor when creating a pager instance, use this function rather than the usual count() function.

Returns:
int

Definition at line 66 of file dataobjectsphinx.base.cls.php.

00066                                       {
00067                 return min($this->count(), APP_SPHINX_MAX_MATCHES);
00068         }
DataObjectSphinxBase::get_sphinx_feature ( name  ) 

Get a sphinx feature.

Returns:
mixed The feature's value or NULL, if not set

Definition at line 82 of file dataobjectsphinx.base.cls.php.

00082                                                   {
00083                 return Arr::get_item($this->sphinx_features, $name, null);
00084         }
DataObjectSphinxBase::index_rotate (  ) 

Reindex.

Returns:
Status

Definition at line 45 of file dataobjectsphinx.base.cls.php.

00045                                        {
00046                 Load::commands('sphinx/index.rotate');
00047                 $cmd = new SphinxIndexRotateCommand($this);
00048                 return $cmd->execute();         
00049         }
DataObjectSphinxBase::set_sphinx_feature ( name,
value  
)

Set a sphinx feature.

Definition at line 73 of file dataobjectsphinx.base.cls.php.

00073                                                           {
00074                 $this->sphinx_features[$name] = $value;
00075         }

Member Data Documentation

DataObjectSphinxBase::$sphinx_all_fields = ''

Definition at line 14 of file dataobjectsphinx.base.cls.php.

DataObjectSphinxBase::$sphinx_features = array()

Definition at line 20 of file dataobjectsphinx.base.cls.php.


The documentation for this class was generated from the following file: