1

我尽量不寻求帮助并自己解决,但这非常困难,我无法弄清楚如何解决它。我正在使用 Python 2.7 和 Django 1.4。我使用 Tomcat 7.0 和 Solr 作为 Haystack v2 beta 的后端。我安装了 Pysolr v 3。Apache Tomcat 服务运行正常,我可以去 127.0.0.1:8000/solr/admin。我运行 manage.py build_solr_schema 并将该 schema.xml 文件放入我的 C:\solr\conf 文件夹中。

作为最后一步,我想运行 manage.py rebuild_index。当我在命令提示符中键入并单击 Enter 时,我会收到通常的消息:

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 71 readings.
Traceback (most recent call last):
File "C:\Users\Tech11\Dropbox\skimreads\skimreads\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 443, in     execute_from
_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
  File "c:\users\tech11\dropbox\django\skimreads\skimreads\src\django-  haystack\haystack\management\c
ommands\rebuild_index.py", line 15, in handle
call_command('update_index', **options)
   File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 150,     in call_command

return klass.execute(*args, **defaults)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
  File "c:\users\tech11\dropbox\django\skimreads\skimreads\src\django-haystack\haystack\management\c
ommands\update_index.py", line 181, in handle
return super(Command, self).handle(*items, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 341, in handle
label_output = self.handle_label(label, **options)
  File "c:\users\tech11\dropbox\django\skimreads\skimreads\src\django-haystack\haystack\management\c
ommands\update_index.py", line 240, in handle_label
do_update(self.backend, index, qs, start, end, total, self.verbosity)
  File "c:\users\tech11\dropbox\django\skimreads\skimreads\src\django-haystack\haystack\management\c
ommands\update_index.py", line 79, in do_update
backend.update(index, current_qs)
  File "c:\users\tech11\dropbox\django\skimreads\skimreads\src\django-haystack\haystack\backends\sol
r_backend.py", line 66, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "build\bdist.win-amd64\egg\pysolr.py", line 746, in add
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1127, in tostring
ElementTree(element).write(file, encoding, method=method)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 821, in write
serialize(write, self._root, encoding, qnames, namespaces)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 940, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 940, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 933, in _serialize_xml
v = _escape_attrib(v, encoding)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1093, in _escape_attrib
_raise_serialization_error(text)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1053, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize 1.0 (type float)

请帮忙,因为我已经为此苦苦挣扎了一段时间。我已经让这个设置在我的家用电脑上工作,但我工作的电脑性能不佳。非常感谢您提前。

4

1 回答 1

0

更新到 pysolr 3.0.6 修复了这个问题。

(我知道我参加聚会有点晚了,但无论如何它可能对某人有帮助。)

于 2013-05-08T16:40:55.740 回答