xunsearch 安装

记录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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,242评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 174,351评论 25 709
  • sayusayme阅读 500评论 0 1
  • 人们曾经认定,人的体能极限决定了没有人能够在4分钟内跑完1英里。许多医生、教练员为这个“定论”找到了许许多多的“科...
    无_名阅读 716评论 3 4
  • 日间与师范老友聊了一阵,是夜,竟梦回母校…… 还是在那个路口下车,西行几十米,便来到母校的大门前。背后是路南的学校...
    叶小秋123阅读 1,030评论 1 5