Template::Error undefined method `total_count'

While trying to search in 8.12.0-ee:

Started GET "/search?utf8=%E2%9C%93&search=plugins&group_id=&project_id=126&search_code=true&repository_ref=pepsi-allocator" for 92.103.57.251 at 2016-09-23 13:03:14 +0000
Processing by SearchController#show as HTML
  Parameters: {"utf8"=>"✓", "search"=>"plugins", "group_id"=>"", "project_id"=>"126", "search_code"=>"true", "repository_ref"=>"pepsi-allocator"}
Completed 500 Internal Server Error in 134ms (ActiveRecord: 3.6ms)

ActionView::Template::Error (undefined method `total_count' for []:Array):
    34:       = link_to search_filter_path(scope: 'commits') do
    35:         Commits
    36:         %span.badge
    37:           = @search_results.commits_count
    38: 
    39:   - elsif @show_snippets
    40:     %li{class: ("active" if @scope == 'snippet_blobs')}
  lib/gitlab/elastic/project_search_results.rb:50:in `commits_count'
  app/views/search/_category.html.haml:37:in `block in _app_views_search__category_html_haml___3261298238502634935_70524060'
  app/views/search/_category.html.haml:34:in `_app_views_search__category_html_haml___3261298238502634935_70524060'
  app/views/search/show.html.haml:6:in `_app_views_search_show_html_haml__577100181596144335_78376700'
  lib/gitlab/request_profiler/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/middleware/readonly_geo.rb:29:in `call'
Assignee Loading
Time tracking Loading