You can escape the string with

org.apache.lucene.queryParser.QueryParser.escape(String query)

http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/queryParser/QueryParser.html#escape%28java.lang.String%29



> -----Original Message-----
> From: ptomb...@gmail.com [mailto:ptomb...@gmail.com] On Behalf Of Paul
> Tomblin
> Sent: Monday, August 17, 2009 5:12 PM
> To: solr-user@lucene.apache.org
> Subject: SolrJ question
>
> If I put an object into a SolrInputDocument and store it, how do I
> query for it back?  For instance, I stored a java.net.URI in a field
> called "url", and I want to query for all the documents that match a
> particular URI.  The query syntax only seems to allow Strings, and if
> I just try query.setQuery("url:" + uri.toString()) I get an error
> because of the colon after "http" in the URI.
>
> I'm really new to Solr, so please let me know if I'm missing something
> basic here.
>
> --
> http://www.linkedin.com/in/paultomblin

Reply via email to