Beautiful! It worked. Thanks so much.


________________________________
From: Shawn Heisey <s...@elyograg.org>
To: solr-user@lucene.apache.org 
Sent: Monday, August 12, 2013 3:12 PM
Subject: Re: Problem escaping ampersands in HTTP GET


On 8/12/2013 12:49 PM, John Randall wrote:
> I am using an HTTP GET to add docs to Solr. All the docs load fine as long as 
> none contain an ampersand. I get a syntax error when a doc contains a field, 
> for example, with the phrase "Jack & Jill".
>
> How can I escape the ampersand so that the doc loads normally?

If the input format of your document is XML and it's in the URL on a 
GET, then you'll need to do two kinds of encoding - first to XML (&amp;) 
and then URL.  The final string for a single ampersand after both kinds 
of encoding is:  %26amp%3B

If you are using JSON format, then I think you could just use %26 for an 
ampersand.

This is one reason that POST is preferred to GET.

Thanks,
Shawn

Reply via email to