From 59aac6cfa8cc8d2b29bc06f5d6f5e6c6795321d3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 21 Sep 2019 18:44:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/searchs/index.json.jbuilder | 2 +- app/views/shixun_lists/index.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/searchs/index.json.jbuilder b/app/views/searchs/index.json.jbuilder index 9983fa61e..51bf4f221 100644 --- a/app/views/searchs/index.json.jbuilder +++ b/app/views/searchs/index.json.jbuilder @@ -10,7 +10,7 @@ json.results do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[\]\(\/api\/attachments\/\d+\)/ + atta_reg = /!\[]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '')&.sub!(atta_reg, '') highlights[:content]&.first&.sub!(reg, '')&.sub!(atta_reg, '') diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index c925d6876..a4e49093a 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -8,7 +8,7 @@ json.shixun_list do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[\]\(\/api\/attachments\/\d+\)/ + atta_reg = /!\[]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '')&.sub!(atta_reg, '') highlights[:content]&.first&.sub!(reg, '')&.sub!(atta_reg, '') From de4b57d0777d4fe9b7970ff10829bbdf0d2bbce5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 21 Sep 2019 18:49:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixun_lists/index.json.jbuilder | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index a4e49093a..67875e82b 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -10,6 +10,8 @@ json.shixun_list do # 附件的替换 atta_reg = /!\[]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '')&.sub!(atta_reg, '') + Rails.logger.info("#########serach_description#{highlights[:description]}------------#{highlights[:description]&.first}") + highlights[:content]&.first&.sub!(reg, '')&.sub!(atta_reg, '') json.title highlights.delete(:name)&.join('...') || obj.searchable_title