alphagov/govuk_content_models — pull request #101 by fatbusinessman (2013-11-13 12:20:05+00:00)
Title: Make the `relatable_items` query use an index.

Without these changes, the `relatable_items` method produces the list using a `BasicCursor`, which is slow and has a limit on the site of data set it'll work on. Adding a suitable index, and tweaking the query so it can use it, avoids this problem.

Restricting the fields returned to the name only means the result can be retrieved solely from the index, without having to deal with the full documents at all. Since this is all we display in Panopticon, it's worth omitting everything else.