From d579ce28a068faab3aa7e89c7e73d2a0eb98addd Mon Sep 17 00:00:00 2001 From: jjandxa Date: Sun, 29 Dec 2019 21:49:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E4=B8=80?= =?UTF-8?q?=E5=9C=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app.ini | 2 ++ composer.json | 2 +- src/Service/XunSearchService.php | 6 +++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5229f64..cfadd3b 100644 --- a/README.md +++ b/README.md @@ -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` 进行安装, 安装完成后对相关文件权限进行设置 ### 其他问题 diff --git a/app.ini b/app.ini index 6c0ea7c..3c63d80 100644 --- a/app.ini +++ b/app.ini @@ -1,4 +1,6 @@ project.name = flarum +server.index = localhost:8383 +server.search = localhost:8384 [id] type = id diff --git a/composer.json b/composer.json index 9e5bbb8..c0c5f8a 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/src/Service/XunSearchService.php b/src/Service/XunSearchService.php index e63c044..893f356 100644 --- a/src/Service/XunSearchService.php +++ b/src/Service/XunSearchService.php @@ -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);