xunsearch 安装
2018-07-19 本文已影响9人
零一间
安装:
$ ll
total 10200
drwxr-xr-x 3 www www 4096 Nov 20 2017 xunsearch-full-1.4.11
-rw-rw-r-- 1 www www 10437337 Nov 20 2017 xunsearch-full-latest.tar.bz2
$ cd xunsearch-full-1.4.11/
$ ./setup.sh
+==========================================+
| Welcome to setup xunsearch(full) |
| 欢迎使用 xunsearch (完整版) 安装程序 |
+------------------------------------------+
| Follow the on-screen instructions please |
| 请按照屏幕上的提示操作以完成安装 |
+==========================================+
Please specify the installation directory
请指定安装目录 (默认为中括号内的值)
[/home/www/xunsearch]:/home/www/s
server/ sites/
/home/www/server/xunsearch
Confirm the installation directory
请确认安装目录:/home/www/server/xunsearch [Y/n]y
Checking scws ... no
Installing scws (1.2.3) ...
Extracting scws package ...
Configuring scws ...
Compiling & installing scws ...
Checking scws dict ... no
Extracting scws dict file ...
Checking libuuid ... yes: /usr
Checking xapian-core-scws ... no
Installing xapian-core-scws (1.2.22) ...
Extracting xapian-core-scws package ...
Configuring xapian-core-scws ...
Compiling & installing xapian-core-scws ...
Checking libevent ... no
Installing libevent (2.0.21-stable) ...
Extracting libevent package ...
Configuring libevent ...
Compiling & installing libevent ...
Extracting xunsearch package (1.4.11) ...
Configuring xunsearch ...
Compiling & installing xunsearch ...
Cleaning ... done
+=================================================+
| Installation completed successfully, Thanks you |
| 安装成功,感谢选择和使用 xunsearch |
+-------------------------------------------------+
| 说明和注意事项: |
| 1. 开启/重新开启 xunsearch 服务程序,命令如下: |
| /home/www/server/xunsearch/bin/xs-ctl.sh restart
| 强烈建议将此命令写入服务器开机脚本中 |
| |
| 2. 所有的索引数据将被保存在下面这个目录中: |
| /home/www/server/xunsearch/data
| 如需要转移到其它目录,请使用软链接。 |
| |
| 3. 您现在就可以在我们提供的开发包(SDK)基础上 |
| 开发您自己的搜索了。 |
| 目前只支持 PHP 语言,参见下面文档: |
| /home/www/server/xunsearch/sdk/php/README
+=================================================+
启动服务
$ cd bin/
$ ./xs-ctl.sh start
INFO: starting server[xs-indexd] ... (BIND:127.0.0.1:8383)
INFO: starting server[xs-searchd] ... (BIND:127.0.0.1:8384)
连接测试:
$ cat test.php
<?php
require __DIR__ . '/lib/XS.php'; // 引入 xunsearch sdk
try {
$xs = new XS('demo'); // demo 为项目名称,配置文件是:$sdk/app/demo.ini
$index = $xs->index; // 获取索引对象
var_dump($index);
} catch (XSException $e) {
echo $e . "\n" . $e->getTraceAsString() . "\n"; // 发生异常,输出描述
}
$ php test.php
object(XSIndex)#7 (9) {
["_buf":"XSIndex":private]=>
string(0) ""
["_bufSize":"XSIndex":private]=>
int(0)
["_rebuild":"XSIndex":private]=>
bool(false)
["xs"]=>
object(XS)#1 (6) {
["_index":"XS":private]=>
*RECURSION*
["_search":"XS":private]=>
NULL
["_scws":"XS":private]=>
NULL
["_scheme":"XS":private]=>
object(XSFieldScheme)#2 (3) {
["_fields":"XSFieldScheme":private]=>
array(4) {
["pid"]=>
object(XSFieldMeta)#3 (7) {
["name"]=>
string(3) "pid"
["cutlen"]=>
int(0)
["weight"]=>
int(1)
["type"]=>
int(10)
["vno"]=>
int(0)
["tokenizer":"XSFieldMeta":private]=>
string(4) "full"
["flag":"XSFieldMeta":private]=>
int(1)
}
["subject"]=>
object(XSFieldMeta)#4 (7) {
["name"]=>
string(7) "subject"
["cutlen"]=>
int(0)
["weight"]=>
int(5)
["type"]=>
int(11)
["vno"]=>
int(1)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(19)
}
["message"]=>
object(XSFieldMeta)#5 (7) {
["name"]=>
string(7) "message"
["cutlen"]=>
int(300)
["weight"]=>
int(1)
["type"]=>
int(12)
["vno"]=>
int(255)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(17)
}
["chrono"]=>
object(XSFieldMeta)#6 (7) {
["name"]=>
string(6) "chrono"
["cutlen"]=>
int(0)
["weight"]=>
int(1)
["type"]=>
int(1)
["vno"]=>
int(3)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(0)
}
}
["_typeMap":"XSFieldScheme":private]=>
array(3) {
[10]=>
string(3) "pid"
[11]=>
string(7) "subject"
[12]=>
string(7) "message"
}
["_vnoMap":"XSFieldScheme":private]=>
array(4) {
[0]=>
string(3) "pid"
[1]=>
string(7) "subject"
[255]=>
string(7) "message"
[3]=>
string(6) "chrono"
}
}
["_bindScheme":"XS":private]=>
object(XSFieldScheme)#2 (3) {
["_fields":"XSFieldScheme":private]=>
array(4) {
["pid"]=>
object(XSFieldMeta)#3 (7) {
["name"]=>
string(3) "pid"
["cutlen"]=>
int(0)
["weight"]=>
int(1)
["type"]=>
int(10)
["vno"]=>
int(0)
["tokenizer":"XSFieldMeta":private]=>
string(4) "full"
["flag":"XSFieldMeta":private]=>
int(1)
}
["subject"]=>
object(XSFieldMeta)#4 (7) {
["name"]=>
string(7) "subject"
["cutlen"]=>
int(0)
["weight"]=>
int(5)
["type"]=>
int(11)
["vno"]=>
int(1)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(19)
}
["message"]=>
object(XSFieldMeta)#5 (7) {
["name"]=>
string(7) "message"
["cutlen"]=>
int(300)
["weight"]=>
int(1)
["type"]=>
int(12)
["vno"]=>
int(255)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(17)
}
["chrono"]=>
object(XSFieldMeta)#6 (7) {
["name"]=>
string(6) "chrono"
["cutlen"]=>
int(0)
["weight"]=>
int(1)
["type"]=>
int(1)
["vno"]=>
int(3)
["tokenizer":"XSFieldMeta":private]=>
int(0)
["flag":"XSFieldMeta":private]=>
int(0)
}
}
["_typeMap":"XSFieldScheme":private]=>
array(3) {
[10]=>
string(3) "pid"
[11]=>
string(7) "subject"
[12]=>
string(7) "message"
}
["_vnoMap":"XSFieldScheme":private]=>
array(4) {
[0]=>
string(3) "pid"
[1]=>
string(7) "subject"
[255]=>
string(7) "message"
[3]=>
string(6) "chrono"
}
}
["_config":"XS":private]=>
array(8) {
["project.name"]=>
string(4) "demo"
["project.default_charset"]=>
string(5) "utf-8"
["server.index"]=>
string(14) "127.0.0.1:8383"
["server.search"]=>
string(14) "127.0.0.1:8384"
["pid"]=>
array(1) {
["type"]=>
string(2) "id"
}
["subject"]=>
array(1) {
["type"]=>
string(5) "title"
}
["message"]=>
array(1) {
["type"]=>
string(4) "body"
}
["chrono"]=>
array(1) {
["type"]=>
string(7) "numeric"
}
}
}
["_sock":protected]=>
resource(7) of type (stream)
["_conn":protected]=>
string(14) "127.0.0.1:8383"
["_flag":protected]=>
int(0)
["_project":protected]=>
string(4) "demo"
["_sendBuffer":protected]=>
string(0) ""
}