ubuntu-10.04的測試環境 安裝測試 Coreseek開源中文檢索引擎-Sphinx中文版

來源:互聯網
上載者:User

標籤:

主要參考文檔: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... -pthreadchecking for LIBS needed for pthreads... -lpthreadchecking for pthreads... foundchecking whether to compile with MySQL support... yeschecking for mysql_config... not foundchecking 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 gettingthis 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 updateapt-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  --allCoreseek 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 MBsorted 0.0 Mhits, 100.0% donetotal 3 docs, 7545 bytestotal 0.018 sec, 416069 bytes/sec, 165.43 docs/sectotal 2 reads, 0.000 sec, 4.2 kb/call avg, 0.0 msec/call avgtotal 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();}    

ubuntu-10.04的測試環境 安裝測試 Coreseek開源中文檢索引擎-Sphinx中文版

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.