alphagov/whitehall — pull request #337 by h-lame (2013-03-12 16:43:45+00:00)
Title: Only index corp info pages belonging to live orgs

1. Fix searchable so that the scope you add to the ``searchable()`` config with the ``:only`` key is used as a guard in ``update_in_search_index``. E.g. if you set ``only: :published`` on something then if the instance you call ``update_in_search_index`` is not present in the published scope, it won't actually be added to the index. This makes ``SearchableClass.search_index`` symmetrical with ``searchable_instance.update_in_search_index`` in that they both obey the ``only`` option.

2. Update the ``only`` scope on ``Person`` so that it properly includes people who have no current ministerial role by allowing those that have *no* role as well.

3. Add an ``only`` scope to ``CorporateInfoPage`` that excludes any that belong to an ``Organisation`` where that organisation is not live on gov.uk. It also won't index any that belong to a ``WorldwideOrganisation``, but this restriction can be relaxed once we fully launch the world stuff (Note: I confirmed that it's ok to index corp pages for worldwide orgs that are sponsored by non-live orgs).

4. Data migration to remove wrongly indexed people and corp info pages