haystack django在球场上的错误' django_ct'

时间:2014-04-29 20:55:38

标签: django python-2.7 solr

有人可以帮我解释为什么django_ct不存在以及为什么solr_backend试图访问这个字段?我错过了任何设置吗?

> Environment:
> Request Method: GET
> Request URL: ## http:\\mysit\search\searchresults\?searchtext=abcd ##
> Django Version: 1.4.2


>Python Version: 2.7.3



>Installed Applications:


>(...


> 'haystack',


> ...')




>Traceback for the error below:


>File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response


>  111.                         response = callback(request, *callback_args, **callback_kwargs)


>File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view


>  48.             return self.dispatch(request, *args, **kwargs)


>File "/usr/local/lib/python2.7/dist-packages/django_conneg-0.9.4-py2.7.egg/django_conneg/views.py" 

>in dispatch


>  241.             return super(ContentNegotiatedView, self).dispatch(request, *args, **kwargs)


>File "/usr/local/lib/python2.7/dist-packages/django_conneg-0.9.4-py2.7.egg/django_conneg/views.py" 

>in dispatch


>  75.         return super(BaseContentNegotiatedView, self).dispatch(request, *args, **kwargs)


>File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch


>  69.         return handler(request, *args, **kwargs)


>File "/usr/lib/python2.7/dist-packages/dataplace/web/search/views.py" in get


>  195.         logger.info("title count =" + repr(sqs.facet_counts()))


>File "/usr/local/lib/python2.7/dist-packages/haystack/query.py" in facet_counts


>  510.             return clone.query.get_facet_counts()


>File "/usr/local/lib/python2.7/dist-packages/haystack/backends/__init__.py" in get_facet_counts


>  656.             self.run()


>File "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py" in run


>  693.         results = self.backend.search(final_query, **search_kwargs)


>File "/usr/local/lib/python2.7/dist-packages/haystack/backends/__init__.py" in wrapper


>  34.             return func(obj, query_string, *args, **kwargs)


>File "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py" in search


>  133.         return self._process_results(raw_results, highlight=kwargs.get('highlight'), 

>result_class=kwargs.get('result_class', SearchResult), distance_point=kwargs.get('distance_point'))


>File "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py" in _process_results


>  371.             app_label, model_name = raw_result[DJANGO_CT].split('.')


>Exception Type: KeyError at /search/searchresults/


>Exception Value: u'django_ct'

1 个答案:

答案 0 :(得分:0)

听起来你的schema.xml文件不是最新的。

你必须跑:

python manage.py build_solr_schema

并将输出内容复制到solr schema.xml文件中。 以下是该命令的docs