lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <>
Subject Re: Is it possible to escape some texts from Solr query?
Date Tue, 04 Sep 2018 15:11:22 GMT
This is a query _parsing_ issue, way before a tokenizer ever gets to
it. The problem of course is that AND is an operator in the query
language, so your problem is how to distinguish it from the value of a

You can always quote the input for id, as in id:"AND" which you could
do for everything you put in that field. You'll have he same problem
with OR and NOT BTW.

On Tue, Sep 4, 2018 at 3:10 AM girish.vignesh <> wrote:
> One of the ID attribute which we are using to query is AND so our looks like
> http://localhost:8983/solr//select?fq=id:AND&wt=json
> This throws below mentioned exception
> error: { metadata: [ "error-class", "org.apache.solr.common.SolrException",
> "root-error-class", "org.apache.solr.parser.ParseException" ], msg:
> " Cannot parse 'id:AND': Encountered "
> "AND "" at line 1
> I can escape AND by using below mentioned queries
> http://localhost:8983/solr//select?fq=entityId:\AND&wt=json
> http://localhost:8983/solr//select?fq=entityId:%22AND%22&wt=json
> Question: I do not want to handle this while making a query. Is there any
> other way to handle this at Solr config level using tokenizer or some other
> way. This way I do not have to handle this at multiple places.
> --
> Sent from:

View raw message