【发布时间】:2014-05-24 21:37:00
【问题描述】:
我在运行时收到以下类型错误:
python manage.py rebuild_index
我当前的设置是 Solr 4.8.1、django-haystack 2.1.0、Django 1.6.2 和 Python 3.4.0。
有人知道是什么原因造成的吗?这是错误线程:
ERROR:root:Error updating blog using default
Traceback (most recent call last):
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/backends/solr_backend.py", line 68, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 779, in add
return self._update(m, commit=commit, waitFlush=waitFlush, waitSearcher=waitSearcher)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 387, in _update
return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 318, in _send_request
error_message = self._extract_error(resp)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 397, in _extract_error
reason, full_html = self._scrape_response(resp.headers, resp.content)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 467, in _scrape_response
full_html = full_html.replace('\n', '')
TypeError: expected bytes, bytearray or buffer compatible object
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/rebuild_index.py", line 16, in handle
call_command('update_index', **options)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 195, in handle
return super(Command, self).handle(*items, **options)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/django/core/management/base.py", line 385, in handle
label_output = self.handle_label(label, **options)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/haystack/backends/solr_backend.py", line 68, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 779, in add
return self._update(m, commit=commit, waitFlush=waitFlush, waitSearcher=waitSearcher)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 387, in _update
return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 318, in _send_request
error_message = self._extract_error(resp)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 397, in _extract_error
reason, full_html = self._scrape_response(resp.headers, resp.content)
File "/Users/aaron/Documents/virtualenvs/three/lib/python3.4/site-packages/pysolr.py", line 467, in _scrape_response
full_html = full_html.replace('\n', '')
TypeError: expected bytes, bytearray or buffer compatible object
【问题讨论】:
-
您好,您可以显示下一个文件:
project/search_indexes.py和project/templates/search/indexes/blog.txt吗?还有您要索引的模型?您必须了解很难帮助您提供有关该问题的信息 -
我也有类似的问题?你解决了吗? @Liarez,你能帮我吗?
-
@Opal 我从来没有解决它。我改变了项目,所以没有花时间找出答案。如果你发现了,请发布它。
标签: python django solr django-haystack