Haystack queryset contains None elements

django-haystack

Solution

I had this problem when haystack index had records without corresponding records in DB.

Problem

I'm using Haystack for search, and the resulting SearchQuerySet returned contains None elements: ``` >> SearchQuerySet().models(Question, Document, Idea) >> [<SearchResult: idea.idea (pk=3875)>, None, None, None] ``` Running rebuild_index doesn't help. If I remove the .models() call from the first line, the problem goes away. I could just filter out None elements from the results, but I wanted to know if this is intended behaviour? I am using Django 1.4, Whoosh, and Haystack 2.0.0-beta

Original source