5.5.1 安装配置
系统默认使用xunsearch作为全文搜索引擎,登录迅搜索(http://www.xunsearch.com/)官网并下载安装最新的稳定安装包(安装包内含安装说明)。
安装完成后,更改CONFIG(data/config/config.ini.php)文件全文搜索部分,配置如下:
# 全文检索配置,支持true(开启) 或 false(关闭),全文检索的详细配置,请参考本帮助的全文检索章节
# 需编辑 data\api\xs\app\shopnc.ini,将server.index 和 server.search 值修改成自己的IP和端口
$config['fullindexer']['open'] = true;
# 全文检索配置文件名(默认为shopnc,不需要更改)
$config['fullindexer']['appname'] = 'shopnc';
然后更改全文搜索配置文件(data/api/xs/app/shopnc.ini),将server.index 和 server.search 值修改成自己的IP和端口
shopnc.ini文件完整解释如下:
# 项目名称(不需要更改)
project.name = shopnc
# 默认字符集 (该项要与当前商城字符集一致)
project.default_charset = UTF-8
# 索引服务端配置,默认端口 8383
server.index = 127.0.0.1:8383
# 搜索服务端配置,默认端口 8384
server.search = 127.0.0.1:8384
# 主键
[pk]
type = id
# 商品ID
[goods_id]
type = numeric
# 商品名称
[goods_name]
type = title
index = mixed
weight = 5
# 分类名称
[gc_name]
index = mixed
weight = 3
# 品牌名称
[brand_name]
index = mixed
weight = 4
# 商品所在一级分类
[cate_1]
index = self
tokenizer = full
# 商品所在二级分类
[cate_2]
index = self
tokenizer = full
# 商品所在三级分类
[cate_3]
index = self
tokenizer = full
# 品牌ID
[brand_id]
index = self
tokenizer = full
# 属性ID
[attr_id]
index = self
tokenizer = split(_)
# 店铺ID
[store_id]
index = self
tokenizer = full
# 一级地区ID
[area_id]
index = self
tokenizer = full
# 商品价格(排序)
[goods_price]
type = numeric
# 商品点击量(排序)
[goods_click]
type = numeric
# 商品销量(销量)
[goods_salenum]
type = numeric
# 商品分类ID
[gc_id]
配置完成后,启动xunsearch进程、索引商品内容到搜索服务器。
# 启动 xunsearch 进程
usr/local/xunsearch/bin/xs-ctl.sh -b inet start
# 清空索引
/usr/bin/php /wwwroot/html/crontab/index.php xs clear
# 全量更新索引
/usr/bin/php /wwwroot/html/crontab/index.php xs create
# 增量更新索引,此命令可以加入系统任务计划中,定时执行,建议执行周期为1小时
/usr/bin/php /wwwroot/html/crontab/index.php xs update
到此,配置工作已经完成,前台可以体验全文搜索了。
Copyright ©2009 - 2014 shopnc.net.All rights reserved.
Powered By ShopNC