I can go into my shell and type
sqs = SearchQuerySet().filter(content='content')
len(sqs)
and I get results. I have inspected them and when I type
sqs[0]
sqs[0].id
sqs[0].text
I get coherent results. However when I use the search form on my website, I get no results.
I don't even define my own SearchView. It is the default one. On the template, I have tried
{% for result in page.object_list %}
{% for result in object_list %}
{% for result in page_obj.object_list %}
and still don't get any results. And the query did run because I can put stuff inside
{% if query %}
so that clearly works. What do I do?
Thank you.
I resolved this by replacing
url(r'^search/', include('haystack.urls')),
with
url(r'^search/?$', views.SearchResultsView.as_view(), name='search-view'),
and making my own SearchResultsView with nothing special in it
class SearchResultsView(SearchView):
template_name = 'search/search.html'
form_class = MySearchForm
queryset = SearchQuerySet().all()
paginate_by = 10
context_object_name = 'object_list'
and using
page_obj
in the template