alphagov/whitehall — pull request #791 by heathd (2013-08-28 13:10:39+00:00)
Title: Speed up document index page by getting edition data only from elastic search

We adapt the elastic search results to look a bit like editions by wrapping them in `Result` objects. The `Result` object also loads the associated `Organisation`, `Topic`, `DocumentSeries` and `OperationalField` from the mysql database.

For atom feeds, we've left it loading the real edition objects from mysql, because atom feeds rely on additional data not in the elasticsearch index.

In development we observed a speedup from ~3000ms to ~700ms.

A possible improvement would be to use `Rails.cache` within `ResultSet` to cache the objects read from mysql (in which case I would load all objects, rather than just the specific ones present in the result set).