1. 我使用xunsearch做搜索功能,为两张表建立了文档索引,一个是文章表,一个是用户表
2. 我的配置文件有两个user.ini article.ini 内容如下
project.name = user
project.default_charset = utf-8
server.index = xxx:8383
server.search = xxx:8384
[id]
type = id
[nickname]
index = self
phrase = yes
[avatar]
[article_numbers]
type = numeric
[follow_numbers]
type = numeric
[fans_numbers]
type = numeric
[createtime]
type = numeric
project.name = article
project.default_charset = utf-8
server.index = xxx:8383
server.search = xxx:8384
[id]
type = id
[author]
type = string
[user_id]
[category_id]
index = self
tokenizer = full
[category]
type = both
[title]
type = title
[cover_url]
type = both
[content]
type = body
[reply_numbers]
type = numeric
[star_numbers]
type = numeric
[read_numbers]
type = numeric
[createtime]
type = numeric
3. 建立索引文档
/**
* 根据文章生成或者更新索引文档
* @param $type string 根据参数判断是更新(update)还是重新生成文章文档(add)
* @param $subject string 根据参数判断是生成文章索引(article)还是生成用户索引(user)
* @return bool
* @throws \XSException
* @throws \think\exception\DbException
*/
p