我已经安装了Apache Solr 4.10.4,django-haystack 2.4.0,pysolr 3.3.2和Django 1.8.6。我在Django框架中完成了一个简单的博客应用程序。我在终端输入以下命令:
(my_env) pecan@tux ~/Documents/Django/mysite $ python manage.py rebuild_index
但是它给我一个错误:
WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
All documents removed.
Indexing 3 posts
ERROR:root:Error updating blog using default
Traceback (most recent call last):
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1080, in _escape_attrib
if "&" in text:
TypeError: argument of type 'int' is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 188, in handle_label
self.update_backend(label, using)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 233, in update_backend
do_update(backend, index, qs, start, end, total, verbosity=self.verbosity, commit=self.commit)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 96, in do_update
backend.update(index, current_qs, commit=commit)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/backends/solr_backend.py", line 75, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/pysolr.py", line 807, in add
m = ET.tostring(message, encoding='utf-8')
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1125, in tostring
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 777, in write
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 942, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 942, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 934, in _serialize_xml
v = _escape_attrib(v)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1092, in _escape_attrib
_raise_serialization_error(text)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1058, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize 1 (type int)
Traceback (most recent call last):
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1080, in _escape_attrib
if "&" in text:
TypeError: argument of type 'int' is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/rebuild_index.py", line 26, in handle
call_command('update_index', **options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 183, in handle
return super(Command, self).handle(*items, **options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/django/core/management/base.py", line 623, in handle
label_output = self.handle_label(label, **options)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 188, in handle_label
self.update_backend(label, using)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 233, in update_backend
do_update(backend, index, qs, start, end, total, verbosity=self.verbosity, commit=self.commit)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/management/commands/update_index.py", line 96, in do_update
backend.update(index, current_qs, commit=commit)
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/haystack/backends/solr_backend.py", line 75, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "/home/pecan/Documents/Django/my_env/lib/python3.4/site-packages/pysolr.py", line 807, in add
m = ET.tostring(message, encoding='utf-8')
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1125, in tostring
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 777, in write
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 942, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 942, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 934, in _serialize_xml
v = _escape_attrib(v)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1092, in _escape_attrib
_raise_serialization_error(text)
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1058, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize 1 (type int)
我必须安装旧版本的软件包和Solr,因为我的书有点古老。
有人能帮助我吗?