ubuntu-10.04的测试环境 安装测试 Coreseek开源中文检索引擎-Sphinx中文版

主要参考文档:http://www.coreseek.cn/products-install/install_on_bsd_linux/

一、

32位版本:

coreseek安装需要预装的软件:

apt-get install make gcc g++ automake libtool mysql-client libmysqlclient15-dev libxml2-dev libexpat1-dev

二、

CoreSeek快速安装:

安装前,建议查看:源码包说明README;4.0/4.1版可参考3.2版本安装,步骤相同;如遇到问题,请看详细安装说明。

##下载coreseek:coreseek 3.2.14:点击下载、coreseek 4.0.1:点击下载、coreseek 4.1:点击下载

$ wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz

$ 或者 http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz

$ 或者 http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz

$ tar xzvf coreseek-3.2.14.tar.gz 或者 coreseek-4.0.1-beta.tar.gz 或者 coreseek-4.1-beta.tar.gz

$ cd coreseek-3.2.14 或者 coreseek-4.0.1-beta 或者 coreseek-4.1-beta

##前提:需提前安装操作系统基础开发库及mysql依赖库以支持mysql数据源和xml数据源

##安装mmseg

$ cd mmseg-3.2.14

$ ./bootstrap #输出的warning信息可以忽略,如果出现error则需要解决

$ ./configure --prefix=/usr/local/mmseg3

$ make && make install

$ cd ..

##安装coreseek

$ cd csft-3.2.14 或者 cd csft-4.0.1 或者 cd csft-4.1

$ sh buildconf.sh #输出的warning信息可以忽略,如果出现error则需要解决

$ ./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql ##如果提示mysql问题,可以查看MySQL数据源安装说明

上一步安装的过程 可能出现的错误:

configuring Sphinx

------------------

checking for CFLAGS needed for pthreads... -pthread

checking for LIBS needed for pthreads... -lpthread

checking for pthreads... found

checking whether to compile with MySQL support... yes

checking for mysql_config... not found

checking MySQL include files... configure: error: missing include files.

******************************************************************************

ERROR: cannot find MySQL include files.

Check that you do have MySQL include files installed.

The package name is typically ‘mysql-devel‘.

If include files are installed on your system, but you are still getting

this message, you should do one of the following:

1) either specify includes location explicitly, using --with-mysql-includes;

2) or specify MySQL installation root location explicitly, using --with-mysql;

3) or make sure that the path to ‘mysql_config‘ program is listed in

your PATH environment variable.

To disable MySQL support, use --without-mysql option.

******************************************************************************

解决方案执行:

apt-get update

apt-get install libmysqlclient15-dev

$ make && make install

$ cd ..

##测试mmseg分词,coreseek搜索(需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文)

$ cd testpack

$ cat var/test/test.xml #此时应该正确显示中文

$ /usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc var/test/test.xml

$ /usr/local/coreseek/bin/indexer -c etc/csft.conf --all

$ /usr/local/coreseek/bin/search -c etc/csft.conf 网络搜索

安装测试完成。

查看版本信息

$ /usr/local/coreseek/bin/indexer -c etc/csft.conf --all

##如要停止搜索服务,请使用

/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf --stop

如果出现下面的错误:

Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2011,

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘/usr/local/coreseek/etc/mysql_csft.conf‘...

FATAL: failed to parse config file ‘/usr/local/coreseek/etc/mysql_csft.conf‘

解决办法:

/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf --pidfile

启动服务:

/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft_mysql.conf --console

##如要已启动服务,要更新索引,请使用

/usr/local/coreseek/bin/indexer -c etc/csft.conf --all --rotate

生成索引

/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft_mysql.conf  --all

Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2011,

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘/usr/local/coreseek/etc/csft_mysql.conf‘...

indexing index ‘mysql‘...

collected 3 docs, 0.0 MB

sorted 0.0 Mhits, 100.0% done

total 3 docs, 7545 bytes

total 0.018 sec, 416069 bytes/sec, 165.43 docs/sec

total 2 reads, 0.000 sec, 4.2 kb/call avg, 0.0 msec/call avg

total 7 writes, 0.000 sec, 3.1 kb/call avg, 0.0 msec/call avg

搜索

/usr/local/coreseek/bin/search -c /usr/local/coreseek/etc/csft_mysql.conf 百度收购

结合php使用:

require ( "sphinxapi.php" );

$sph = new SphinxClient ();

$sph -> SetServer (‘10.2.6.101‘, 9312 );

$sph -> setMatchMode(SPH_MATCH_ANY);

//$sph -> SetArrayResult ( true );

$sph -> SetLimits(0, 15, 1000);

$sph -> SetMaxQueryTime(10);

$index = ‘index_main1‘;

$dbname = ‘test‘;

$table = ‘documents‘;

$result = $sph->Query ($wd, $index);

if($result == false)

{

echo ‘<pre>‘;

var_dump ($sph->GetLastError());exit();

}

if(isset($result[‘total_found‘]) && $result[‘total_found‘]>0)

{

$matches = $result[‘matches‘];

$keys = array_keys($matches);

include ‘MiniMysql.php‘;

$db = new MiniMysql(array(‘host‘=>‘localhost‘,‘user‘=>‘root‘,‘pwd‘=>‘root‘,‘dbname‘=>$dbname,‘prefix‘=>‘mj_‘));

$list = $db -> getArray(‘SELECT id,title,content FROM `‘.$table.‘` WHERE id IN (‘.implode(‘,‘,$keys).‘)‘);

$html = array();

$keys = array_flip($keys);

$opts = array(

‘before_match‘ => ‘<font style=\‘font-weight:bold;color:red\‘>‘,

‘after_match‘ => ‘</font>‘,

‘limit‘ => 150,

);

foreach ($list as $key => $val )

{

$tmp = $sph->buildExcerpts($val,‘index_main1‘,$wd,$opts);

$html[$keys[$val[‘id‘]]] =

‘<div>‘.

‘<a href="" title="" target="">‘.$tmp[‘1‘].‘</a>‘.

‘<p class="brief">‘.$tmp[‘2‘].‘</p>‘.

‘</div>‘;

//$html[] = $html[$keys[$val[‘id‘]]] = ‘<div><a href="" title="" target="">‘.$val[‘title‘].‘</a></div>‘;

}

ksort($html);

echo implode(‘‘,$html);

}

else

{

echo ‘‘;

exit();

}

时间: 2024-07-29 22:55:00

ubuntu-10.04的测试环境 安装测试 Coreseek开源中文检索引擎-Sphinx中文版的相关文章

ubuntu 10.04.4版本第一次安装注意点和说明

引语:linux现在主要有两个系,一个是Redhat系和debian系,redhat系有redhat,centos等版本操作系统,debian系有ubuntu等版本操作系统:可能大家习惯用了redhat系的linux,如果再用上debian系的ubuntu后会有好多很多的不同和需要注意的地方: 注意点如下: 1我第一次安装ubuntu10.04.4 server版本后,直到安装完都没有root这个用户的设置,只在安装过程有设置一般用户,这就导致我切换到root用户不知道密码,事实上我们第一次登陆

Ubuntu 16.04下Java环境安装与配置

首先下载linux下的安装包 登陆网址https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载完成后,Linux默认下载位置在当前目录下的Download或下载文件夹下,通过命令cd ~/Downloads或cd  ~/下载即可查看到对应的文件. 扩展:linux下打开目录~和/的区别 解压安装包jdk-8u202-linux-x64-demos.tar.gz tar -zxvf

分布式进阶(三)Ubuntu 10.04 之JDK安装

Ubuntu 10.04 之JDK安装 1.从官网 (http://www.Oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html)下载安装文件(如:jdk-6u45-linux-x64.bin).复制该文件到/usr/lib/java下,如果没有java文件夹,则创建它.sudo mkdir  -p  /usr/lib/jvm/java 安转文件默认是没有执行权限的,所以首先第一步是要将安装文件赋予

ubuntu 10.04 安装arm交叉编译器

家里有一台cotext-A9(armv7-a) 的盒子,现在不用了, 一直想着废物利用.于是想怎么为这盒子编译程序. 目标机器: [email protected]:/# uname -a Linux routon-h1 2.6.34 #3 SMP Mon Oct 29 19:01:06 CST 2012 armv7l GNU/Linux 装了一台 ubuntu 10.04 X86 的虚拟机 [email protected]:~# uname -a Linux ubuntu 2.6.32-38

在虚拟机下安装ubuntu 10.04 64bit,并修改root用户密码

实验的环境: 笔记本是:HP 虚拟机:VMware  9 准备安装的操作系统: ubuntu 10.04  64bit 实验步骤: 一:让自己的hp支持虚拟化技术(由于ubuntu 10.04  64bit需要CPU支持虚拟化技术,所以要通过bios来更改电脑的默认设置) 启动时根据提示按 Esc 键 按 F10 键以配置 BIOS 使用箭头键滚动到"System Configuration" 选择"Virtualization Technology",然后按 En

[转载]SharePoint 2013测试环境安装配置指南

软件版本 Windows Server 2012 标准版 SQL Server 2012 标准版 SharePoint Server 2013 企业版 Office Web Apps 2013 备注:安装之前,需要各个服务器的IP地址,机器名称设置好,并且已经加入到域中. 一 安装AD域控制器 1. 添加AD服务 a) 打开服务器管理器,选择[添加角色和功能] b) 在[开始之前]页面直接点击[下一步] c) 选择[基于角色或基于功能的安装]后,点击[下一步] d) 选择[从服务器池中选择服务器

分布式进阶(四)Ubuntu 10.04下安装Tomcat 6

Ubuntu 10.04下安装Tomcat 6 1,下载apache-tomcat6, 地址链接:http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.28/bin/ 选择Ubuntu Linux适用版本,即apache-tomcat-6.0.28.tar.gz文件, 2,复制安装文件到/usr/local/目录下面,在控制台console输入命令, sudo cp /home/shq/桌面/apache-tomcat-6.0.28.tar.gz

t420 win7 硬盘安装ubuntu 10.04 LTS 备忘

http://zhangwen.sinaapp.com/?p=5 t420 win7 硬盘安装ubuntu 10.04 LTS 备忘 发表于 2011 年 10 月 25 日 对ubuntu的新版没有感觉,还是决定换回10.04 LTS.安装过程中遇到很多问题,在这里记录一下. 一.下载软件 1.下载ubuntu 10.04的iso镜像 http://www.ubuntu.org.cn/download/ 存到d盘的根目录下 d:/ubuntu-10.04.3-desktop-i386.iso

阿里云 Ubuntu 16.04 搭建LAMP环境

平时都用公司的测试服务器,而公司的服务器都是我们老大搭好的.最近趁着双十一阿里云搞活动,买了个低配置的服务器自己玩玩.俗话说,好记性不如烂笔头,还是把配置过程记下来吧! 操作系统:Ubuntu 16.04 64位 1.查看apt源 vim /etc/apt/sources.list 阿里云源: deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main restricted universe multiverse deb http://mi