alphagov/rummager — pull request #132 by jamiecobbett (2013-07-16 09:18:03+00:00)
Title: Searches can specify a sort field and order

This will let us add a "sort by date" feature to (government) results on gov.uk/search

The API copies advanced_search, and relies on the Rack::Utils parse_nested_query behaviour, common in Rails apps: http://rdoc.info/gems/rack/Rack/Utils.parse_nested_query

As pointed out by @fatbusinessman, there are disadvantages to using this way of encoding parameters:
* whilst it is "standard" in Ruby, the standard seems to consist of "Rack does it this way", so for third-parties (via Content API), using the API won't be as easy
* the relevant specifications are not clear about whether square brackets are valid in URLs.

On the other hand, there are advantages:
* consistency with the ``/advanced_search`` API
* concise and scalable way of expressing one or more sort fields and their orders