[Answered ]-Getting raw results from Django Haystack

2👍

You can use SearchQuerySet. For example:

In [1]: from haystack.query import SearchQuerySet

In [2]: SearchQuerySet().filter(content='abra')
Out[2]: [<SearchResult: art.artist (pk=u'23')>, <SearchResult: art.artwork (pk=u'191')>]

In [3]: SearchQuerySet().filter(content='abra').count()
Out[3]: 2
👤jpic

0👍

You can use SearchQuerySet like : –

SearchQuerySet().filter(content='abra').models(MyModel)

It will only return result from MyModel model.

Leave a comment