thanks for reply softark…
sphinx is search server full text, http://sphinxsearch.com/ indexing database from mysql.
sphinx so powerful can find query in 0,00003 mil second.
sphinx have difference query with mysql :
http://sphinxsearch.com/
[color="#000080"]to get offset in mysql : " limit 5 offset 10 "
to get offset in sphinx using this : "limit 5,10 "
to get count in sphinx using this : " show meta "[/color]
i have make changes yii CDbCommandBuilder class in applylimit function :
in line "offset" i change "offset" to " , "
i hope sql limit offset can return from "limit 5 offset 10" to "limit 5,10"
public function applyLimit($sql,$limit,$offset)
{
if($limit>=0)
$sql.=' LIMIT '.(int)$limit;
if($offset>0)
$sql.=' , '.(int)$offset;
// $sql.=' , '.(int)$offset; i have changed from $sql.=' offset'.(int)$offset; to "'"
return $sql;
}like this :
wow finally grid showing data from query sphinx. but paging not work in page 3.
in header tbgridview page 1 : showing 10-10 from 40 result
in header tbgridview page 2 : showing 11 -20 from 40 result
but in header page 3: [color="#FF0000"]showing 11-30 from 40 result
[/color]
i confused why tbgridview page 3 header why[color="#FF0000"]showing 11-30 from 40 result
[/color] not from 21-30
my question :
do you know why header page showing 11-30 from 40 result not 21-30 from 40 ?
this is because i have make changes CDbCommandBuilder class in applylimit function.
where function class that make result header in grid "showing 11-30 from 40 result"
this is my sphinx command.
$dsn = 'mysql:dbname=catalog;host=127.0.0.1;port=9306;';
$port = '9306';
$connection = new CDbConnection($dsn);
$connection->active = true;
$sqlStatement = "select catalogid,title from catalog where match('@title ORACLE') group by catalogid order by value asc";
$key = 'catalogid';
$result = $connection->createCommand($sqlStatement)->queryAll();
$countResult = $connection->createCommand('show meta;')->queryAll();
foreach ($countResult as $data) {
if ($data['Variable_name'] == "total_found") {
$count = $data['Value'];
}
}
$dataProvidersphinx = new CSqlDataProvider($sqlStatement,
array(
'keyField' => $key,
'totalItemCount' => $count,
'sort' =>
array('attributes' => array('entry', 'value',)
,), 'pagination' =>
array('pageSize' => 10,),));
$dataProvidersphinx->db = $connection;