安装coreseek遇到mmseg安装失败的问题 及php 方法封装

//参数
/*
 * key  关键字
 * index_name  索引资源
 * table 哪个表
 * t_index 表主键
 * page 页码
 * num 每页的条数
 * order 排序 降序
 * */


 function sphinx_search($key,$index_name,$table,$t_index,$page,$num,$order)
{




    $cl=new \SphinxClient();

    $cl->SetServer('127.0.0.1',9312);

    $cl->SetArrayResult(true);

    $cl->SetMatchMode(SPH_MATCH_ANY);
    $cl->SetSortMode(SPH_SORT_RELEVANCE);
//    $cl->SetLimits(0,12);
//    排序
    $cl->SetSortMode (SPH_SORT_EXTENDED,"id DESC");
//    var_dump($order);die;
//    分页
     $start_limit=($page-1)*$num;
     $cl->SetLimits($start_limit,$num);
//     var_dump($key,$index_name);die;
//        key 关键字   索引名称
    $res=$cl->Query($key,$index_name);

//var_dump($res);die;

    $ids=array_column($res['matches'],"id");

    var_dump($ids);die;
    $where[$t_index]=array("in",$ids);


//    var_dump($where);die;

    $res=think\Db::table($table)->where($where)->select();
//        var_dump($res);die;

    $arr_tag=array();
    foreach ($res as $v){
        $arr_tag['title'][]=$v['title'];
        $arr_tag['tag'][]=$v['tag'];
        $arr_tag['summary'][]=$v['summary'];
    }



    $opts = array(
        "before_match"     => "

", "after_match" => "

", "chunk_separator" => "...", "limit" => 20, "around" => 205, "single_passage" => true, "exact_phrase" => false ); // var_dump($arr_tag);die; foreach ($arr_tag as $k=> &$v){ $res2[$k]= $cl->buildExcerpts($v , $index_name, $key,$opts); } $cl->close(); // var_dump($res);die; foreach ($res as $k=> $v){ // var_dump($res[$k]);die; // var_dump($res[$k]['title']);var_dump($arr_tag['title'][$k]);die; $res[$k]['title']=$res2['title'][$k]; $res[$k]['tag']=$res2['tag'][$k]; $res[$k]['summary']=$res2['summary'][$k]; } return $res; }
[root@localhost mmseg-3.2.14]#  make && make install
make  all-recursive
make[1]: 进入目录“/coreseek-4.1-beta/mmseg-3.2.14”
Making all in src
make[2]: 进入目录“/coreseek-4.1-beta/mmseg-3.2.14/src”
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -fPIC -I.. -I.. -I../src/css -I../src/utils -D_REENTRANT -D_LARGEFILE64_SOURCE    -g -O2 -MT SegmenterManager.lo -MD -MP -MF .deps/SegmenterManager.Tpo -c -o SegmenterManager.lo `test -f 'css/SegmenterManager.cpp' || echo './'`css/SegmenterManager.cpp
../libtool: line 879: X--tag=CXX: command not found
../libtool: line 912: libtool: ignoring unknown tag : command not found
../libtool: line 879: X--mode=compile: command not found
../libtool: line 1046: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1047: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 1190: Xg++: command not found
../libtool: line 1190: X-DHAVE_CONFIG_H: command not found
../libtool: line 1190: X-I.: command not found
../libtool: line 1190: X-I..: command not found
../libtool: line 1190: X-fPIC: command not found
../libtool: line 1190: X-I..: command not found
../libtool: line 1190: X-I..: command not found
../libtool: line 1190: X-I../src/css: No such file or directory
../libtool: line 1190: X-I../src/utils: No such file or directory
../libtool: line 1190: X-D_REENTRANT: command not found
../libtool: line 1190: X-D_LARGEFILE64_SOURCE: command not found
../libtool: line 1190: X-g: command not found
../libtool: line 1190: X-O2: command not found
../libtool: line 1190: X-MT: command not found
../libtool: line 1190: XSegmenterManager.lo: command not found
../libtool: line 1190: X-MD: command not found
../libtool: line 1190: X-MP: command not found
../libtool: line 1190: X-MF: command not found
../libtool: line 1190: X.deps/SegmenterManager.Tpo: No such file or directory
../libtool: line 1190: X-c: command not found
../libtool: line 1243: XSegmenterManager.lo: command not found
../libtool: line 1248: libtool: compile: cannot determine name of library object from `': command not found
make[2]: *** [SegmenterManager.lo] 错误 1
make[2]: 离开目录“/coreseek-4.1-beta/mmseg-3.2.14/src”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/coreseek-4.1-beta/mmseg-3.2.14”
make: *** [all] 错误 2


http://blog.sina.com.cn/s/blog_75a07c3b0101kkin.html
问题如上所述,刚开始一直百度下面的error问题,也没有得出什么结果,后来我就认真阅读问题,发现是libtool的问题
原因据说是因为在项目目录下生成的libtool脚本中定义了echo(生成的libtool版本太旧)

打开aclocal.m4文件,可以在很前面的一段配置中找到这么两句

# This can be used to rebuild libtool when needed  
LIBTOOL_DEPS="$ltmain"  
  
# Always use our own libtool.  
LIBTOOL='$(SHELL) $(top_builddir)/libtool'  
AC_SUBST(LIBTOOL)dnl  

可通过以下方法解决:

  1. 直接复制系统自带的libtool到项目目录,应该在/usr/bin目录下,覆盖代码文件目录下的libtool,再执行make

(没装就apt-get install libtool 或者 yum install libtool 安装一下吧)

  1. 修改aclocal.m4文件,将上面的LIBTOOL='(top_builddir)/libtool'改成LIBTOOL='$(SHELL) /usr/bin/libtool'后重新执行./configure
  1. 将源码目录下libtool脚本中所有的echo. 或者将脚本文件ltmain.sh里的ECHO,都一样,重新执行./configure

生成configure文件报错
http://www.mamicode.com/info-detail-1904342.html

sphinxexpr.cpp:1746:43: 附注:use ‘this->ExprEval’ instead
http://www.mamicode.com/info-detail-1309224.html

https://blog.csdn.net/qq_35118483/article/details/78410987

可能出现的问题:
可能出现的错误
ERROR: index 'phperz': sql_connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (DSN=mysql://root:***@localhost:3306/phperz).
这是因为mysql的sock文件路经不正确导致的.
确认一下你的mysql.sock路经,建立一个软连接,比如
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

注意要先建立索引才能启用服务

你可能感兴趣的:(安装coreseek遇到mmseg安装失败的问题 及php 方法封装)