0

I am having trouble running a query using Pysolr when & and % appear in the query. The rest of the special characters can be handled using a '\' but '&' and '%' are a different case. the following query sends an error, but when & and % are removed it works fine. Can someone help?

http:///1.254.254.254:8983solr/dovecottmail/select?fq=user:%22user@xyz.com%22&indent=on&wt=python&q="https://aws.amazon.com/marketplace/pp/b074m84rjm\%qid=1507365354908\&amp\;sr=0-1\&amp\;ref_=srh_res_product_title"

Rohan Garg
  • 35
  • 5

1 Answers1

0

You can encode your query parameter while passing to solr.

Please find below example.

  http://1.254.254.254:8983:solr/dovecottmail/select?fq=user:%22user@xyz.com%22&indent=on&wt=python&q=%22https%3A%2F%2Faws.amazon.com%2Fmarketplace%2Fpp%2Fb074m84rjm%5C%25qid%3D1507365354908%5C%26amp%5C%3Bsr%3D0-1%5C%26amp%5C%3Bref_%3Dsrh_res_product_title%22

It will works for you ...

  • yes, this helps. Thanks a lot. Can you tell me where I can find the list of these encodings for Pysolr? – Rohan Garg Jun 21 '18 at 05:07
  • You can simply encode it using any language encode function I have encoded your query using simple online encoder, please find below link. [Online Encoder](https://www.urlencoder.org/) – Rahul Holkar Jun 21 '18 at 12:27