記錄xunsearch 安裝 使用
Checking scws ... 1.2.3-dev
Checking scws dict ... ok
Checking libuuid ... yes: /var/webwww/xunsearch
Checking xapian-core-scws ... no
Installing xapian-core-scws (1.2.20) ...
Extracting xapian-core-scws package ...
Configuring xapian-core-scws ...
-----
checking for fdatasync... yes
checking for fsync... yes
checking for pread... yes
checking for any prototype needed for pread... none required
checking for pwrite... yes
checking for any prototype needed for pwrite... none required
checking for link... yes
checking for scws... yes: /var/webwww/xunsearch
checking for scws_new in -lscws... no
configure: error: scws_new() NOT found in libscws, please check it first.
-----
ERROR: failed to configure xapian-core-scws, see 'setup.log' for more detail
這個錯誤需要定位到安裝目錄,這里是/var/webwww/xunsearch
cd ./lib
建立兩個軟鏈接(此方法無效) 共享空間惹的禍
去非共享目錄,一次就成功
+=================================================+
| Installation completed successfully, Thanks you |
| 安裝成功,感謝選擇和使用 xunsearch |
+-------------------------------------------------+
| 說明和注意事項: |
| 1. 開啟/重新開啟 xunsearch 服務程序,命令如下: |
| /var/web/xunsearch/bin/xs-ctl.sh restart
| 強烈建議將此命令寫入服務器開機腳本中 |
| |
| 2. 所有的索引數據將被保存在下面這個目錄中: |
| /var/web/xunsearch/data
| 如需要轉移到其它目錄,請使用軟鏈接。 |
| |
| 3. 您現在就可以在我們提供的開發包(SDK)基礎上 |
| 開發您自己的搜索了。 |
| 目前只支持 PHP 語言,參見下面文檔: |
| /var/web/xunsearch/sdk/php/README
+=================================================+
使用部分
tp5使用composer引入
有個坑:
$xs = new XS('demo'); // 自動使用 $prefix/sdk/php/app/demo.ini 作項目配置文件
$xs = new XS('/path/to/demo.ini'); // 使用 /path/to/demo.ini
前者可能路徑錯誤,官方建議使用后者,如下
define ('XS_APP_ROOT', '/path/to/ini')
$xs = new \XS(XS_APP_ROOT);
清空項目索引內容
$xs->index->clean();
配置
文件名www.ini
項目名稱
project.name = www
字符集
project.default_charset = UTF-8
服務器連接參數
server.index = 8383
server.search = 8384
字段定義
[field_name]
type字段類型
type = string
string
numeric
date
id
title
body
index索引方式
通常情況默認值為 none ,但 id 型字段默認是 self ,title 型字段是 both ,body 型字段則固定為 mixed 。
index = none
none
self
mixed
both(self+mixed)
tokenizer 分詞器
tokenizer = default
full
none
split
xlen
xstep
scws