Django+Haystack+Elastic issue

31 views
Skip to first unread message

Nick Gilmour

unread,
May 22, 2017, 5:42:29 PM5/22/17
to django...@googlegroups.com
Hi all,

 

I'm following an example to setup Django with Haystack and ES from here:

https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html


Everything seems to be working OK except from the number of the results – they are always maximal 20. But actually a single query should give more than 50 results.

So, where does this limitation come from? How can I change it?

I cannot find a setting neither for haystack nor for django which prevents showing more than 20 results.

 

Thanks,

Nick

Avraham Serour

unread,
May 24, 2017, 10:57:04 AM5/24/17
to django-users
it sounds like elastic is paginating, did you check that?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Nick Gilmour

unread,
May 24, 2017, 6:07:46 PM5/24/17
to django...@googlegroups.com
Thanks for the hint!
It seems to be related with Django's pagination:
with:
{{ page.paginator.count }}
and
{{ page.paginator.num_pages }}
I can see that I have 58 hits and 3 pages, which is correct. 
I was getting maximal 2 pages with 20 pages each.
Now I have to check how pagination in Django works...

Nick Gilmour

unread,
May 25, 2017, 2:20:30 AM5/25/17
to django...@googlegroups.com
It is related with Django's pagination...

The results per page value can be set with:
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20
in the settings.py.

I had found and defined this setting before but it wasn't working because I had this in the HAYSTACK_CONNECTIONS dict (don't ask me why...).

I have increased it to 50 and I'm getting 50 hits.



Reply all
Reply to author
Forward
0 new messages