```ruby
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
```

Sort rummager fields by type
user
```ruby
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
```
assistant