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 RAUNAK AGRAWAL <ag...@gmail.com> on 2018/03/27 06:44:05 UTC

How to escape OR or any other keyword in solr

I have to search for state "OR" [short form for Oregon]. When I am making
query state:OR, I am getting SolrException since it is recognising it as
keyword.

Now I tried with quotes ("") or //OR as well and when doing so..Solr
doesn't give exception but it also doesn't return any matching document.

Kindly let me know what is the workaround for this issue?

Thanks

Re: How to escape OR or any other keyword in solr

Posted by Steven White <sw...@gmail.com>.
What about for the case when you need to match cases as such the analyzer
does not use LowerCaseFilterFactory?  Is there a solution for this?

Steve

On Tue, Mar 27, 2018 at 4:22 AM, RAUNAK AGRAWAL <ag...@gmail.com>
wrote:

> Hi Peter,
>
> Yes, I am using the stopword file which has *or *in it. Thanks for pointing
> out. Will remove it from the stopword file and test it again. Thank you
> very much!!
>
> On Tue, Mar 27, 2018 at 1:17 PM, Peter Lancaster <
> peter.lancaster@findmypast.com> wrote:
>
> > Hi Raunak,
> >
> > Are you using a stop word file? That might be why you're getting 0
> results
> > searching for "OR".
> >
> > Cheers,
> > Peter.
> >
> > -----Original Message-----
> > From: RAUNAK AGRAWAL [mailto:agrawal.raunak@gmail.com]
> > Sent: 27 March 2018 07:45
> > To: solr-user@lucene.apache.org
> > Subject: How to escape OR or any other keyword in solr
> >
> > I have to search for state "OR" [short form for Oregon]. When I am making
> > query state:OR, I am getting SolrException since it is recognising it as
> > keyword.
> >
> > Now I tried with quotes ("") or //OR as well and when doing so..Solr
> > doesn't give exception but it also doesn't return any matching document.
> >
> > Kindly let me know what is the workaround for this issue?
> >
> > Thanks
> > ________________________________
> >
> > This message is confidential and may contain privileged information. You
> > should not disclose its contents to any other person. If you are not the
> > intended recipient, please notify the sender named above immediately. It
> is
> > expressly declared that this e-mail does not constitute nor form part of
> a
> > contract or unilateral obligation. Opinions, conclusions and other
> > information in this message that do not relate to the official business
> of
> > findmypast shall be understood as neither given nor endorsed by it.
> > ________________________________
> >
> > ____________________________________________________________
> ______________
> >
> > This email has been checked for virus and other malicious content prior
> to
> > leaving our network.
> > ____________________________________________________________
> ______________
> >
>

Re: How to escape OR or any other keyword in solr

Posted by Erick Erickson <er...@gmail.com>.
Also, a rather obscure bit is that unless you configure it, operators
must be upper case.
You can simply lower-case it on the client side if necessary, so "or"
won't be interpreted
as an operator.

Best,
Erick

On Tue, Mar 27, 2018 at 1:22 AM, RAUNAK AGRAWAL
<ag...@gmail.com> wrote:
> Hi Peter,
>
> Yes, I am using the stopword file which has *or *in it. Thanks for pointing
> out. Will remove it from the stopword file and test it again. Thank you
> very much!!
>
> On Tue, Mar 27, 2018 at 1:17 PM, Peter Lancaster <
> peter.lancaster@findmypast.com> wrote:
>
>> Hi Raunak,
>>
>> Are you using a stop word file? That might be why you're getting 0 results
>> searching for "OR".
>>
>> Cheers,
>> Peter.
>>
>> -----Original Message-----
>> From: RAUNAK AGRAWAL [mailto:agrawal.raunak@gmail.com]
>> Sent: 27 March 2018 07:45
>> To: solr-user@lucene.apache.org
>> Subject: How to escape OR or any other keyword in solr
>>
>> I have to search for state "OR" [short form for Oregon]. When I am making
>> query state:OR, I am getting SolrException since it is recognising it as
>> keyword.
>>
>> Now I tried with quotes ("") or //OR as well and when doing so..Solr
>> doesn't give exception but it also doesn't return any matching document.
>>
>> Kindly let me know what is the workaround for this issue?
>>
>> Thanks
>> ________________________________
>>
>> This message is confidential and may contain privileged information. You
>> should not disclose its contents to any other person. If you are not the
>> intended recipient, please notify the sender named above immediately. It is
>> expressly declared that this e-mail does not constitute nor form part of a
>> contract or unilateral obligation. Opinions, conclusions and other
>> information in this message that do not relate to the official business of
>> findmypast shall be understood as neither given nor endorsed by it.
>> ________________________________
>>
>> __________________________________________________________________________
>>
>> This email has been checked for virus and other malicious content prior to
>> leaving our network.
>> __________________________________________________________________________
>>

Re: How to escape OR or any other keyword in solr

Posted by RAUNAK AGRAWAL <ag...@gmail.com>.
Hi Peter,

Yes, I am using the stopword file which has *or *in it. Thanks for pointing
out. Will remove it from the stopword file and test it again. Thank you
very much!!

On Tue, Mar 27, 2018 at 1:17 PM, Peter Lancaster <
peter.lancaster@findmypast.com> wrote:

> Hi Raunak,
>
> Are you using a stop word file? That might be why you're getting 0 results
> searching for "OR".
>
> Cheers,
> Peter.
>
> -----Original Message-----
> From: RAUNAK AGRAWAL [mailto:agrawal.raunak@gmail.com]
> Sent: 27 March 2018 07:45
> To: solr-user@lucene.apache.org
> Subject: How to escape OR or any other keyword in solr
>
> I have to search for state "OR" [short form for Oregon]. When I am making
> query state:OR, I am getting SolrException since it is recognising it as
> keyword.
>
> Now I tried with quotes ("") or //OR as well and when doing so..Solr
> doesn't give exception but it also doesn't return any matching document.
>
> Kindly let me know what is the workaround for this issue?
>
> Thanks
> ________________________________
>
> This message is confidential and may contain privileged information. You
> should not disclose its contents to any other person. If you are not the
> intended recipient, please notify the sender named above immediately. It is
> expressly declared that this e-mail does not constitute nor form part of a
> contract or unilateral obligation. Opinions, conclusions and other
> information in this message that do not relate to the official business of
> findmypast shall be understood as neither given nor endorsed by it.
> ________________________________
>
> __________________________________________________________________________
>
> This email has been checked for virus and other malicious content prior to
> leaving our network.
> __________________________________________________________________________
>

RE: How to escape OR or any other keyword in solr

Posted by Peter Lancaster <pe...@findmypast.com>.
Hi Raunak,

Are you using a stop word file? That might be why you're getting 0 results searching for "OR".

Cheers,
Peter.

-----Original Message-----
From: RAUNAK AGRAWAL [mailto:agrawal.raunak@gmail.com]
Sent: 27 March 2018 07:45
To: solr-user@lucene.apache.org
Subject: How to escape OR or any other keyword in solr

I have to search for state "OR" [short form for Oregon]. When I am making query state:OR, I am getting SolrException since it is recognising it as keyword.

Now I tried with quotes ("") or //OR as well and when doing so..Solr doesn't give exception but it also doesn't return any matching document.

Kindly let me know what is the workaround for this issue?

Thanks
________________________________

This message is confidential and may contain privileged information. You should not disclose its contents to any other person. If you are not the intended recipient, please notify the sender named above immediately. It is expressly declared that this e-mail does not constitute nor form part of a contract or unilateral obligation. Opinions, conclusions and other information in this message that do not relate to the official business of findmypast shall be understood as neither given nor endorsed by it.
________________________________

__________________________________________________________________________

This email has been checked for virus and other malicious content prior to leaving our network.
__________________________________________________________________________