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..67875e82b 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -8,8 +8,10 @@ json.shixun_list do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[\]\(\/api\/attachments\/\d+\)/ + 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