Michael Lissner
unread,Jan 16, 2012, 7:19:16 PM1/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Sunburnt
I hate Unicode too much to get beyond simply hacking my way around
this, but I encountered an error when adding certain documents to the
index.
The error was occurring in schema.py, in the following function:
class SolrUnicodeField(SolrField):
def from_user_data(self, value):
if isinstance(value, SolrString):
return value
elif isinstance(value, unicode) or isinstance(value, long):
return WildcardString(unicode(value))
else:
return WildcardString(unicode(value, encoding='utf-8'))
There was one problem, that required two fixes:
1. The encoding wasn't provided, and on my system that was defaulting
to ascii, which occasionally crashed.
2. Once the encoding is in place, things get wonky for other types of
variables, so I added the elif statement as well.
My solution is certainly not robust (and it's a hack), but I figured
I'd put it up here to see if this was a problem unique to me, or if
this was something others would run into.
And also to see what the better solution to this is, if anybody knows
offhand.
Mike