一切都还可以,但我的127.0.0.1:8000无法显示任何内容,为什么?我使用了django-sphinx

时间:2010-02-05 02:26:36

标签: python django sphinx django-sphinx

from djangosphinx.models import SphinxSearch
def xx(request):
    queryset =File.search.query('test')
    #return HttpResponse(queryset)#<------1
    return render_to_response('a.html',{'a':queryset})#<--------2

class File(models.Model):
    name = models.CharField(max_length=200)
    tags = models.CharField(max_length=200) # We actually store tags for efficiency in tag,tag,tag format here

    objects = models.Manager()
    search  = SphinxSearch(index="test1")

a.html:

{% for i in a %}
    Some value: {{i}}
{% endfor %}

1 个答案:

答案 0 :(得分:0)

由于你没有提供大量信息,我会做出有根据的猜测。您可能没有构建搜索索引。尝试在查询之前构建它,在sindex中搜索sphynx,而不是在DB中。