[英]Pagination problem with Django haystack
i'm using django-haystack with simple engine, the search is fine, but the pagination is not working. 我正在使用具有简单引擎的django-haystack,搜索很好,但是分页不起作用。 This is the code of my search results template
这是我的搜索结果模板的代码
{% if query %}
<br>
<div id="contenido_pagina">
{% for result in page.object_list %}
{% if result.object.get_model == '[Video] ' %}
{% if result.object.publicar %}
<div class="salida_search">
<a href="{{result.object.get_full_url}}">{{result.object.get_model}}{{result.object.nombre}}</a><br>
<div class="resumen_search">
{{result.object.sinopsis|safe|truncatewords:"30"}}
</div>
<div class="link_search">
<a href="{{result.object.get_full_url}}">{{result.object.anio}}</a>
</div>
</div>
{% endif %}
{% else %}
<div class="salida_search">
<a href="{{result.object.get_full_url}}">{{result.object.get_model}}{{result.object.titulo}}</a><br>
<div class="resumen_search">
{% if result.object.contenido %}
{{result.object.contenido|safe|truncatewords:"30"}}
{% else %}
{{result.object.sinopsis|safe|truncatewords:"30"}}
{% endif %}
</div>
<div class="link_search">
<a href="{{result.object.get_full_url}}">{{result.object.fecha|date:"d M Y"}}</a>
</div>
</div>
{% endif %}
{% empty %}
<div>La busqueda <span class="highlighted">{{query}}</span> no obtuvo ningun resultado</div>
{% endfor %}
{% if page.has_previous or page.has_next %}
<div>
{% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Anterior{% if page.has_previous %}</a>{% endif %}
|
{% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Siguiente »{% if page.has_next %}</a>{% endif %}
</div>
{% endif %}
</div>
<br>
{% else %}
{# Show some example queries to run, maybe query syntax, something else? #}
{% endif %}
when i go to the next page i see the same objects that first page. 当我转到下一页时,我会看到与第一页相同的对象。 What i am doing wrong??
我做错了什么?
I had this issue as well. 我也有这个问题。 From debugging the code it looks like it's an issue with the paginator and the searchqueryset.
通过调试代码,看起来像是分页器和searchqueryset的问题。 Unfortunately i didn't have more time to devote to it and ended up moving on to whoosh for development environment.
不幸的是,我没有更多的时间专注于它,最终转向了飞快的开发环境。
Just encountered this. 刚遇到这个。 Seems as though it's a known limitation of the simple backend.
似乎这是简单后端的已知限制。
https://github.com/toastdriven/django-haystack/issues/320 https://github.com/toastdriven/django-haystack/issues/320
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.