dev_cs
cxt 5 years ago
parent f40b3cfe08
commit 9a61ad3e9d

@ -2,7 +2,6 @@ json.shixuns_count @results.total_count
json.shixun_list do json.shixun_list do
json.array! @results.with_highlights(multiple: true) do |obj, highlights| json.array! @results.with_highlights(multiple: true) do |obj, highlights|
puts obj
json.merge! obj.to_searchable_json json.merge! obj.to_searchable_json
json.challenge_names obj.challenges.pluck(:subject) json.challenge_names obj.challenges.pluck(:subject)
@ -12,7 +11,7 @@ json.shixun_list do
highlights[:content]&.first&.sub!(reg, '') highlights[:content]&.first&.sub!(reg, '')
json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.title highlights.delete(:name)&.join('...') || obj.searchable_title
json.description highlights[:description]&.join('...') || obj.description json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..Searchable::MAXIMUM_LENGTH]
json.content highlights json.content highlights
json.level level_to_s(obj.trainee) json.level level_to_s(obj.trainee)

Loading…
Cancel
Save