On 3/10/2015 1:39 PM, Ryan, Michael F. (LNG-DAY) wrote:
> You'll need to wrap the date in quotes, since it contains a colon:
>
> String a = "speechDate:\"1992-07-10T17:33:18Z\"";

You could also escape the colons with a backslash.  Here's another way
to do it that doesn't require quotes or manual escaping:

  String d = "1992-07-10T17:33:18Z";
  String a = "speechDate:" + ClientUtils.escapeQueryChars(d);

If you wanted to go to the trouble of using StringBuilder instead of
string concatenation for performance reasons, you could certainly do that.

This is the class you need to import in order to use escapeQueryChars:

http://lucene.apache.org/solr/4_10_2/solr-solrj/org/apache/solr/client/solrj/util/ClientUtils.html

Thanks,
Shawn

Reply via email to