Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created September 22, 2012 15:58
Show Gist options
  • Save kezabelle/3766607 to your computer and use it in GitHub Desktop.
Save kezabelle/3766607 to your computer and use it in GitHub Desktop.
WTF Haystack
>>> # Why does applying a list of models increase the number of results
>>> # when that list of models accounts for all search indexes?
>>> from haystack.query import SearchQuerySet
>>> from haystack.forms import model_choices
>>> from django.db.models import get_model
>>> models = [get_model(*x[0].split('.')) for x in model_choices()]
>>> len(models)
6
>>> sqs = SearchQuerySet()
>>> sqs.count()
1290
>>> sqs.models(*models).count()
46342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment