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.
- [Answered ]-Could serializer's to_representation generate multiple output items in DRF 3?
- [Answered ]-How can a django forms.CharField generate a required input?
- [Answered ]-Store special data on failed authentication
Source:stackexchange.com