'Confirm that the documents in the search index match the database'

def verify_indexed_documents(self):

    res = self.solr.search(u'*:*', fl=[u'id'], rows=50)
    self.assertEqual(res.hits, 23)
    indexed_doc_ids = set((i[u'id'] for i in res.docs))
    expected_doc_ids = set(((u'core.mockmodel.%d' % i) for i in MockModel.objects.values_list(u'pk', flat=True)))
    self.assertSetEqual(indexed_doc_ids, expected_doc_ids)
