You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by James Brady <ja...@gmail.com> on 2008/02/19 14:16:42 UTC
Bug fix for Solr Python bindings
Hi,
Currently, the solr.py Python binding casts all key and value
arguments blindly to strings. The following changes deal with Unicode
properly and respect multi-valued parameters passed in as lists:
131a132,142
> def __makeField(self, lst, f, v):
> if not isinstance(f, basestring):
> f = str(f)
> if not isinstance(v, basestring):
> v = str(v)
> lst.append('<field name="')
> lst.append(self.escapeKey(f))
> lst.append('">')
> lst.append(self.escapeVal(v))
> lst.append('</field>')
>
143,147c154,158
< lst.append('<field name="')
< lst.append(self.escapeKey(str(f)))
< lst.append('">')
< lst.append(self.escapeVal(str(v)))
< lst.append('</field>')
---
> if isinstance(v, list): # multi-valued
> for value in v:
> self.__makeField(lst, f, value)
> else:
> self.__makeField(lst, f, v)
James