django – haystack.exceptions.SearchBackendError:在任何search_index中都找不到任何字段.请在尝试搜索之前更正此问题

django – haystack.exceptions.SearchBackendError:在任何search_index中都找不到任何字段.请在尝试搜索之前更正此问题,第1张

概述我试图用嗖嗖声实施Haystack. 我一直收到这个错误,虽然一切似乎都配置得很好.我收到错误: haystack.exceptions.SearchBackendError: No fields were found in any search_indexes. Please correct this before attempting to search. …当我尝试做./manage.py 我试图用嗖嗖声实施haystack.

我一直收到这个错误,虽然一切似乎都配置得很好.我收到错误:

haystack.exceptions.SearchBackendError: No fIElds were found in any search_indexes. Please correct this before attempting to search.

…当我尝试做./manage.py rebuild_index

组态:

haystack_SITECONF = 'myproject'haystack_SEARCH_ENGINE = 'whoosh'haystack_WHOOSH_PATH = cwd + '/whoosh/mysite_index'

在我的项目的根文件夹中成功创建了whoosh / mysite_index目录.

* search_sites.py *

import haystackhaystack.autodiscover()

* search_indexes.py *

from haystack.indexes import *from haystack import sitefrom myproject.models import *class ResearchersIndex(SearchIndex):    text = CharFIEld(document=True,use_template=True)    name = CharFIEld(model_attr='name')class SubjectIndex(SearchIndex):    short_name = CharFIEld(model_attr='short_name')    name = CharFIEld(model_attr='name')    text = CharFIEld(document=True,use_template=True)class ResearchIndex(SearchIndex):    text = CharFIEld(document=True,use_template=True)    abstract = TextFIEld(model_attr='abstract')    methodology = TextFIEld(model_attr='methodology')    year = IntegerFIEld(model_attr='year')    name = CharFIEld(model_attr='name')class Graph(SearchIndex):    text = CharFIEld(document=True,use_template=True)    explanation = TextFIEld(model_attr='explanation')    type = CharFIEld(model_attr='type')    name = CharFIEld(model_attr='name')site.register(Researchers,ResearchersIndex)site.register(Subject,SubjectIndex)site.register(Research,ResearchIndex)site.register(Graph,GraphIndex)

谢谢

解决方法 问题出在您的haystack_SITECONF中.它必须是search_sites文件的路径.解决这个问题,它应该工作. 总结

以上是内存溢出为你收集整理的django – haystack.exceptions.SearchBackendError:在任何search_index中都找不到任何字段.请在尝试搜索之前更正此问题全部内容,希望文章能够帮你解决django – haystack.exceptions.SearchBackendError:在任何search_index中都找不到任何字段.请在尝试搜索之前更正此问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/langs/1196813.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存