当&和%出现在查询中时,我无法使用Pysolr运行查询。其余的特殊字符可以使用'\'进行处理,但是'&'和'%'是不同的情况。以下查询会发送错误,但是当删除&和%时,它可以正常工作。有人可以帮忙吗?
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\&sr=0-1\&ref_=srh_res_product_title” < / em>
答案 0 :(得分:0)
您可以在传递给solr时对查询参数进行编码。
请在下面找到示例。
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
它将为您服务...