You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Furkan KAMACI <fu...@gmail.com> on 2013/10/08 10:58:36 UTC

What is the full list of Solr Special Characters?

I found that:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \

at that URL:
http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Escaping+Special+Characters

I'm using Solr 4.5 Is there any full list of special characters to escape
inside my custom search API before making a request to SolrCloud?

Re: What is the full list of Solr Special Characters?

Posted by Shawn Heisey <so...@elyograg.org>.
On 10/8/2013 3:01 AM, Furkan KAMACI wrote:
 > Actually I want to remove special characters and wont send them into my
 > Solr indexes. I mean user can send a special query as like a SQL 
injection
 > and I want to prevent my system such kind of scenarios.

There is a newer javadoc than the *very* old one you are looking at:

http://lucene.apache.org/core/4_5_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html?is-external=true#Escaping_Special_Characters

When I compare that list to what's actually in the SolrJ 
"escapeQueryChars" method, it looks like that method does one additional 
character - the semicolon.

http://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_4_5_0/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java

Just search the page for "escapeQueryChars" to see the java code.

Thanks,
Shawn


Re: What is the full list of Solr Special Characters?

Posted by Furkan KAMACI <fu...@gmail.com>.
Actually I want to remove special characters and wont send them into my
Solr indexes. I mean user can send a special query as like a SQL injection
and I want to prevent my system such kind of scenarios.


2013/10/8 Furkan KAMACI <fu...@gmail.com>

> I found that:
>
> + - && || ! ( ) { } [ ] ^ " ~ * ? : \
>
> at that URL:
> http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Escaping+Special+Characters
>
> I'm using Solr 4.5 Is there any full list of special characters to escape
> inside my custom search API before making a request to SolrCloud?
>