json.count @results.total_count json.results do json.array! @results.with_highlights(multiple: true) do |obj, highlights| json.merge! obj.to_searchable_json json.type obj.class.name.downcase json.title highlights.delete(:name)&.join('...') || obj.searchable_title end end