没有找到结果 - haystack django whoosh
我有一个大问题!
我正在使用 haystack 、 whoosh 和 django 。我确信我已经完成了使其按照文档正常工作所需的一切。
但!!!!搜索结果始终是:“未找到结果”。但是,如果我放入表单中的符号是空格,则我索引的每个对象都会打印
详细信息:
在我的 search_indexes.py 中,我有:
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
中创建了模板并打印
{{ object.type_id }}
{{ object.name }}
{{ object.serial }}
在那里。
顺便说一句,我这样做了
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
,结果是 0 到底是怎么回事????
请帮助我!
I have a huge problem!
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
Details:
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)
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 }}
there.
By the way I did
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().all()
>>> sqs.count()
And result was 0
What the hell is going on????
Help me please!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还没有提到搜索文档的名称。它应该是:uspd_text.txt
doco 说:
您需要在模板目录中创建一个名为 search/indexes/myapp/note_text.txt 的新模板,并将以下内容放入其中
You haven't mentioned what the search document is called. It should be: uspd_text.txt
The doco said:
You’ll need to create a new template inside your template directory called search/indexes/myapp/note_text.txt and place the following inside