php - Yii2 sphinx query not works after deployment on client server -


i use yii2-advanced sphinx on server , works fine, after website deployment on client server exception when trying query result. both servers has php5.6 version.

sphinx config:

source investmo_index {     type = mysql     sql_host = localhost     sql_user = user     sql_pass = password     sql_db = database     sql_port = 9306      sql_query_pre = set names utf8     sql_query_pre = set character set utf8      sql_query = \         select \             id, \             title, \             slug, \             header, \             content ,\             created_at \         page \         is_active='1';      sql_field_string = title         sql_field_string = slug     sql_field_string = header      sql_field_string = content     sql_attr_timestamp = created_at      sql_ranged_throttle = 0 }   index investmo_index {     source = investmo_index     path = /var/www/sphinx/investmo_index     docinfo = extern     mlock = 0     morphology = stem_enru     min_word_len = 1     html_strip = 1     index_exact_words = 1     charset_table = 0..9, a..z->a..z, _, a..z, u+410..u+42f->u+430..u+44f, u+430..u+44f     min_infix_len = 1 }  searchd {     listen = 127.0.0.1:9312     listen = 9306:mysql41     log = /var/log/sphinx/searchd.log     query_log = /var/log/sphinx/query.log     read_timeout = 5     max_children = 30     pid_file = /var/run/sphinx/searchd.pid     max_matches = 1000     seamless_rotate = 1     preopen_indexes = 1     unlink_old = 1     workers = threads # rt work     binlog_path = /var/lib/sphinx } 

php code:

namespace frontend\controllers;  use yii; use yii\sphinx\query; use yii\data\activedataprovider; use common\models\page;  class searchcontroller extends \yii\web\controller {     public function actionindex()     {         $searchphrase = yii::$app->request->get('search');         $order = yii::$app->request->post('order', false);          $provider = false;         $answers = false;         $count = false;          if (!empty($searchphrase)) {             $query = new query;             $query = $query                 ->select([                     '*',                     'snippet(title, \''.$searchphrase.'\', \'before_match=<mark>\', \'after_match=</mark>\') _title',                     'snippet(header, \''.$searchphrase.'\', \'before_match=<mark>\', \'after_match=</mark>\') _header',                     'snippet(content, \''.$searchphrase.'\', \'before_match=<mark>\', \'after_match=</mark>\') _content'                 ])                 ->from('investmo_index')                 ->match($searchphrase)                 ->snippetoptions(['before_match' => '<mark>', 'after_match' => '</mark>']);               if ($order == 'date') {                 $query = $query->orderby(['created_at' => sort_desc]);             } else if ($order == 'title') {                 $query = $query->orderby(['title' => sort_asc]);             }              // here error             $command = $query->createcommand();             // var_dump($command->sql);             var_dump($command->queryall());             exit;              $provider = new activedataprovider([                 'query' => $query,                 'pagination' => [                     'pagesize' => 10,                     'route' => '/search/search/',                 ]             ]);              $count = $query->count();             $answers = $provider->getmodels();         }          return $this->render('index', [             'phrase' => $searchphrase,             'answers' => $answers,             'provider' => $provider,             'count' => $count,         ]);     } 

$command->sql works fine on both servers

'select *, snippet(title, 'test', 'before_match=<mark>', 'after_match=</mark>') _title, snippet(header, 'test', 'before_match=<mark>', 'after_match=</mark>') _header, snippet(content, 'test', 'before_match=<mark>', 'after_match=</mark>') _content `investmo_index` match(:qp0)' 

$command->queryall() works fine on server, on client server throws database exception

exception (database exception) 'yii\db\exception' message 'sqlstate[42000]: syntax error or access violation: 1064 index investmo_index: parse error: snippet() requires 2 arguments sql being executed was: select *, snippet(title, 'test', 'before_match=<mark>', 'after_match=</mark>') _title, snippet(header, 'test', 'before_match=<mark>', 'after_match=</mark>') _header, snippet(content, 'test', 'before_match=<mark>', 'after_match=</mark>') _content `investmo_index` match('test')' 

what can wrong?

issue solved. @barryhunter, said problem in sphinx version.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -