找不到结果-haystack django whoosh [英] no result are found - haystack django whoosh

查看:145
本文介绍了找不到结果-haystack django whoosh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大问题!

我正在使用干草堆,whoosh和django。我确定我已经按照文档完成了所有必要的工作。

I am using haystack and whoosh and django. I am sure I've done everything that is required to be done to make it works according to the documentation.

但是!!!!搜索的结果是:始终没有找到结果。但是,如果我在表单中输入的符号是空格,则会打印出我已索引的每个对象

BUT!!!! results of searching are: "no results found" all the time. But if symbols I put into the form are spaces, every objects I've indexed are printed

详细信息:

在我的search_indexes.py中,我有:

In my search_indexes.py I have:

from haystack.indexes import *
from haystack import site
from aias.models import Uspd

class UspdIndex(SearchIndex):
    text   = CharField(document=True, use_template=True)
    serial = CharField(model_attr = 'serial')
    type_id = IntegerField(model_attr = 'type_id')
    name   = CharField(model_attr = 'name')

    def get_queryset(self):
        return Uspd.objects.all()                                                                                       
site.register(Uspd, UspdIndex)

我创建了文件夹 folder_where_I_have_templates / search / indexes / name_of_my_applcation 中的模板并打印

I've created template in folder folder_where_I_have_templates/search/indexes/name_of_my_applcation and printed

{{ object.type_id }}
{{ object.name }}
{{ object.serial }}

有。

通过我的方式

>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()

结果为0
到底是怎么回事?? ??

And result was 0 What the hell is going on????

请帮助我!

推荐答案

您还没有提到了搜索文件的名称。应该是:uspd_text.txt

You haven't mentioned what the search document is called. It should be: uspd_text.txt

doco说:

您需要创建在您的模板目录中一个名为search / indexes / myapp / note_text.txt的新模板,并将以下内容放入

这篇关于找不到结果-haystack django whoosh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆