Skip to content

Commit

Permalink
优化查询一场处理
Browse files Browse the repository at this point in the history
  • Loading branch information
jjandxa committed Dec 29, 2019
1 parent 7e8fab7 commit d579ce2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Flarum 论坛中文搜索插件 - 基于 xunsearch 搜索引擎开发
>`gawk make gcc g++ zlib1g-dev`
### 安装插件
`sudo composer require jjandxa/flarum-ext-chinese-search`
`composer require jjandxa/flarum-ext-chinese-search`
> 如果遇到权限问题, 则使用 `sudo` 进行安装, 安装完成后对相关文件权限进行设置
### 其他问题
Expand Down
2 changes: 2 additions & 0 deletions app.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
project.name = flarum
server.index = localhost:8383
server.search = localhost:8384

[id]
type = id
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jjandxa/flarum-ext-chinese-search",
"description": "chinese search",
"version": "0.0.8",
"version": "0.0.9",
"type": "flarum-extension",
"license": "Apache License 2.0",
"authors": [
Expand Down
6 changes: 5 additions & 1 deletion src/Service/XunSearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ function convertDiscussion($query, $limit, $offset, $sort) {

}

$tempDiscData = $search->search("title:$query OR $query");
try {
$tempDiscData = $search->search("title:$query OR $query");
} catch (\XSException $e) {
$tempDiscData = [];
}

// 取消折叠
$search->setCollapse(null);
Expand Down

0 comments on commit d579ce2

Please sign in to comment.