zf1315
- zf1315 2014-12-27 已签到连续签到4天,获得了20个金钱
我用的是ubuntu13.10,在安装完毕sphinxsearch后,在/etc/sphinxsearch/下有个sphinx.conf配置文件(注:不要问我关于windows下如何配置sphinx)
searchd { # [hostname:]port[:protocol], or /unix/socket/path to listen on # known protocols are 'sphinx' (SphinxAPI) and 'mysql41' (SphinxQL) # # multi-value, multiple listen points are allowed # optional, defaults are 9312:sphinx and 9306:mysql41, as below # # listen = 127.0.0.1 # listen = 192.168.0.1:9312 # listen = 9312 # listen = /var/run/searchd.sock listen = 9312 listen = 9306:mysql41 # log file, searchd run info is logged here # optional, default is 'searchd.log' log = /var/log/sphinxsearch/searchd.log # query log file, all search queries are logged here # optional, default is empty (do not log queries) }
- zf1315 2014-12-26 已签到连续签到3天,获得了15个金钱
- zf1315 发表了说说在这个里面是不是只能写关于yii的东西,那我如果写ubuntu的资料,不知道行不行
在composer.json中的require中添加:"yiisoft/yii2-sphinx": "*"
然后在配置文件中添加该插件:return [ //.... 'components' => [ 'sphinx' => [ 'class' => 'yii\sphinx\Connection', 'dsn' => 'mysql:host=127.0.0.1;port=9306;', 'username' => '', 'password' => '', ], ], ];
使用的时候,举个例子如下:
$sql = 'SELECT * FROM idx_item WHERE group_id = :group_id'; $params = [ 'group_id' => 17 ]; $rows = Yii::$app->sphinx->createCommand($sql, $params)->queryAll();
@xing18c: 在sphinx的配置文件中配置呀
在composer.json中的require中添加:"yiisoft/yii2-sphinx": "*"
然后在配置文件中添加该插件:return [ //.... 'components' => [ 'sphinx' => [ 'class' => 'yii\sphinx\Connection', 'dsn' => 'mysql:host=127.0.0.1;port=9306;', 'username' => '', 'password' => '', ], ], ];
使用的时候,举个例子如下:
$sql = 'SELECT * FROM idx_item WHERE group_id = :group_id'; $params = [ 'group_id' => 17 ]; $rows = Yii::$app->sphinx->createCommand($sql, $params)->queryAll();