From f1ff06df797b24ce588348dada1e175256f0798d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 21 Sep 2019 19:00:20 +0800 Subject: [PATCH] =?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 | 1 - app/views/shixun_lists/index.json.jbuilder | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/searchs/index.json.jbuilder b/app/views/searchs/index.json.jbuilder index be62bf865..65c4d248c 100644 --- a/app/views/searchs/index.json.jbuilder +++ b/app/views/searchs/index.json.jbuilder @@ -13,7 +13,6 @@ json.results do atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '') highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} - Rails.logger.info("#########serach_description#{highlights[:description]}------------#{highlights[:description]&.first}") highlights[:content]&.first&.sub!(reg, '') highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index 67875e82b..79ce4b09c 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -8,11 +8,12 @@ json.shixun_list do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[]\(\/api\/attachments\/\d+\)/ - highlights[:description]&.first&.sub!(reg, '')&.sub!(atta_reg, '') - Rails.logger.info("#########serach_description#{highlights[:description]}------------#{highlights[:description]&.first}") + atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ - highlights[:content]&.first&.sub!(reg, '')&.sub!(atta_reg, '') + highlights[:description]&.first&.sub!(reg, '') + highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.first&.sub!(reg, '') + highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '')