class SearchApiReference
  def self.fetch_field_definitions
    contents = HTTP.get(
      field_definitions_url,
    )

    JSON.parse(contents)
  end

  def self.field_definitions_url
    "https://raw.githubusercontent.com/alphagov/rummager/master/config/schema/field_definitions.json"
  end
end

class SearchApiReference
  def self.fetch_field_definitions
    contents = HTTP.get(
      field_definitions_url,
    )

    fields = JSON.parse(contents)
    fields.sort_by { |name, definition| [definition["type"], name] }
  end

  def self.field_definitions_url
    "https://raw.githubusercontent.com/alphagov/rummager/master/config/schema/field_definitions.json"
  end
end

Sort rummager fields by type
Sort rummager fields by type

This makes it easier to follow and see related fields.
