def group_sorted_results(search_results)
      grouped_results = {}
      sort_order = {}
      search_results[:hits][:hits].each_with_index do |result, index|
        model = result[:_source][:model].to_sym
        model_id = result[:_source][:id]
        sort_order["#{model}_#{model_id}"] = index # save the sort order
        grouped_results[model] ||= []
        grouped_results[model] << model_id
      end
      [grouped_results, sort_order]
    end
def group_sorted_results(search_results)
      grouped_results = {}
      sort_order = {}
      search_results[:hits][:hits].each_with_index do |result, index|
        model = result[:_source][:model].to_sym
        model_id = result[:_source][:id]
        sort_order["#{model}_#{model_id}"] = index # save the sort order
        grouped_results[model] ||= []
        grouped_results[model] << model_id
      end
      [grouped_results, sort_order]
    end
group the results by { class_name: [ids] } and save their sorted order