Django+Haystack+Elastic issue

瀏覽次數:31 次
跳到第一則未讀訊息

Nick Gilmour

未讀,
2017年5月22日 下午5:42:292017/5/22
收件者: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

未讀,
2017年5月24日 上午10:57:042017/5/24
收件者: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

未讀,
2017年5月24日 下午6:07:462017/5/24
收件者: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

未讀,
2017年5月25日 凌晨2:20:302017/5/25
收件者: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.



回覆所有人
回覆作者
轉寄
0 則新訊息