开发者

Everything is ok, but my 127.0.0.1:8000 can't show anything, why ? I used django-sphinx

开发者 https://www.devze.com 2022-12-19 19:08 出处:网络
from djangosphinx.models import SphinxSearch def xx(request): queryset =File.search.query(\'test\') #return HttpResponse(queryset)#<------1
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

and

class File(models.Model):
    name = models.CharField(max_length=200)
    tags = models.CharField(max_length=200) # We actually store tags f开发者_运维问答or efficiency in tag,tag,tag format here

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

a.html:

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


Since you are not giving a lot of info, I will make a educated guess. You probably didn't build you search index. Try building it before quering, sphynx search in the sindex, not in the DB.

0

精彩评论

暂无评论...
验证码 换一张
取 消