sphinx 的安裝與應用

2021-08-06 01:33:30 字數 2503 閱讀 8051

1、php的windoes sphinx擴充套件安裝

php的linux 

sphinx擴充套件安裝

wget 

tarzxf sphinx-1.3.0.tgz 

cdsphinx-1.3.0 

/usr/local/php/bin/phpize 

./configure --with-php-config=/usr/local/php/bin/php-config--with-sphinx=/usr/local/sphinx/ 

make&& make install

2、 sphinx服務安裝

coreseek官方**:

products/="/products-install/step_by_step/

products-install/mysql/

具體操作:

一、安裝編譯工具

yum install make gcc g++ gcc-c++ libtool autoconf automakeimake mysql-devel libxml2-devel expat-devel

二 、安裝coreseek

2、安裝mmseg

tar zxvf coreseek-3.2.14.tar.gz #解壓

cd coreseek-3.2.14/

mmseg-3.2.14

./bootstrap #輸出的warning資訊可以忽略

./configure --prefix=/usr/local/mmseg3 #配置

make && make install #

#編譯安裝

3、安裝coreseek

cd coreseek-3.2.14/csft-3.2.14

sh buildconf.sh #輸出的warning資訊可以忽略

./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 #配置

make && make install#

#編譯安裝

3、建立索引檔案

/usr/local/coreseek/bin/indexer-c 

/usr/local/coreseek/etc/csft_mysql.conf 

--all# 生成全部索引檔案的命令

/usr/local/coreseek/bin/indexer-c 

/usr/local/coreseek/etc/csft_mysql.conf 

--all 

--rotate 

#--rotate:該引數可以使我們在不需要停止searchd的情況下,直接載入索引

/usr/local/coreseek/bin/indexer-c 

/usr/local/coreseek/etc/csft_mysql.conf

--rotateindex_search_main

#生成主索引

/usr/local/coreseek/bin/indexer-c 

/usr/local/coreseek/etc/csft_mysql.conf

--rotateindex_search_main_delta

#生成增量索引

/usr/local/coreseek/bin/indexer -c/

usr/local/coreseek/etc/csft_mysql.conf

--mergeindex_search_main index_search_main_delta --rotate

#增量索引和主索引的合併

/usr/local/coreseek/bin/searchd-c  /

usr/local/coreseek/etc/csft_mysql.conf開啟

/usr/local/coreseek/bin/searchd-c  /

usr/local/coreseek/etc/csft_mysql.conf

--stop為關閉

4、api呼叫

$index = 'test1';

$key = '北';

$sc = new sphinxclient();

$sc->setserver('192.168.33.10',9312);

#$sc->setmatchmode(sph_match_all);

$sc->setmatchmode(sph_match_extended);

$sc->setarrayresult(true);

$res = $sc->query($

key,$index);

$err = $sc->getlasterror();

print_r($res);

print_r($err);

Sphinx安裝與使用

首先你要有mysql環境,我使用的是lnmp環境 wget tar zxvf sphinx 2.2.11 release tar.gz cd sphinx 2.2.11 release tar.gz configure prefix usr local sphinx with mysql usr l...

sphinx安裝使用

解壓收編譯配置 configure prefix usr local sphinx with mysql make make install cd usr local sphinx etc cp sphinx.conf.dist sphinx.conf 使用sphinx自帶的例子 匯入測試資料 my...

sphinx編譯安裝

注釋 prefix 指定sphinx安裝到何處,我的安裝目錄是 usr local webserver sphinx with mysql mysql的安裝目錄,我的安裝目錄是 usr local webserver mysql 執行 searchd命令 如看到以下資訊則表示安裝成功 如果提示沒有當...