Skip to content

Bad URL Encoding #32

Description

@GoogleCodeExporter
Using solrpy==0.9.5:

There is an issue with URL encoding in this version. For example, I was trying 
to run the following query:

/select?q=stuff&defType=edismax&qf=name+description+name_subwords+description_su
bwords&wt=json&debug=true

c.query(text, fields=['type', 'id', 'name', 'description', 'name_subwords', 
'description_subwords'], defType='edismax', 
qf='name+description+name_subwords+description_subwords')

When core.py tries to URL encode the parameters on this line:

self.conn.request('POST', url, body.encode('UTF-8'), _headers)

the body.encode('UTF-8') changes the '+' characters to their proper URL 
encoding, '%2B'. This is a serious problem because solr doesn't understand qf 
fields delimited by %2B, just +

The Fix:

self.conn.request('POST', url, body.encode('UTF-8').replace('%2B', '+'), 
_headers)

Tada!

Original issue reported on code.google.com by Stevenrecio on 3 Dec 2012 at 9:02

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions