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 Ranveer Kumar <ra...@gmail.com> on 2010/02/01 08:13:05 UTC

Re: getting error when ":" in the query

Hi
thanks for reply.

Is it possible to filter the special character. If I will allow then need to
put "\" before every special character, which will consume time and create
performance issue. So I want to just filter those special char from user
input query.

However I would also like to know that, is there any short way to put "\"
before special character which will not effect the performance.

thanks
with regards

On Sun, Jan 31, 2010 at 10:09 PM, NarasimhaRaju <ra...@yahoo.com> wrote:

> Hi,
> you have to escape lucene special characters present in usersearch term
> before handing it over to QueryParser.
> for more info look at
> http://lucene.apache.org/java/2_9_1/queryparsersyntax.html#Escaping%20Special%20Characters
>
>
>
>  “ There are only 10 types of people in this world:-
> Those who understand binary and those who don’t “
>
>
> Regards,
> P.N.Raju,
>
>
>
>
> ________________________________
> From: Ranveer Kumar <ra...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Sun, January 31, 2010 5:35:37 PM
> Subject: getting error when ":" in the query
>
> Hi All,
>
> Facing problem when someone searching the string which carry special
> character " : ".
> For example:
>
> when querying by "ipod:touch" then throwing exception due to " : ".
>
> Jan 31, 2010 9:56:35 PM org.apache.solr.common.SolrException log
> SEVERE: org.apache.solr.common.SolrException: undefined field ipod
>
> my full query is :
>
> http://localhost:8080/solr/select?q=ipod:touch&hl=true&start=0&rows=10&hl.fragsize=0&hl.fl=body&hl.snippets=2&wt=xml&version=2.2
>
> is there any configuration to allow ":" in query.
> please help.
>
> thanks
> with regards
> Ranveer K Kumar
>
>
>
>
>

Re: getting error when ":" in the query

Posted by Ahmet Arslan <io...@yahoo.com>.
> However I would also like to know that, is there any short
> way to put "\"
> before special character which will not effect the
> performance.

There is a static method in org.apache.lucene.queryParser.QueryParser that does this: QueryParser.escape(String s);