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 Surender Reddy <su...@swooptalent.com> on 2018/12/02 03:24:16 UTC

Issue with SolrQuery( Adding +) -- Need help urgent

HI,
   We have upgraded Our Solr from 4.7.3 to 7.5.0 . The query that we are sending to Solr was working in fine in 4.7.3 but failing in 7.5.0.
   When we noticed , Space in Query is getting replaced by + and causing issue . If we replace extra + with space in the query and executing from Admin UI , it is working fine. Can someone help how to resolve this issue? Appreciate your help!

Query we are sending to Solr:

 +displayNameWords:[2 TO 5] +((+preferredLocationCountry:"United States" +preferredLocationState:Alabama)) +((+(allContents:java^10.0 allContents:eclipse allContents:java-

Query in Solr log:

+displayNameWords:[2+TO+5]++((+preferredLocationCountry:"United+States"++preferredLocationState:Alabama))++((+(allContents:java^10.0+allContents:eclipse+allContents:java-

Thanks,
  Surender.

Re: Issue with SolrQuery( Adding +) -- Need help urgent

Posted by Jan Høydahl <ja...@cominvent.com>.
Hi,

What you are seeing in the log is simply URLencoded string of the query, so this is expected. In URLEncoding, space is represented as +, and a plus is represented by %2B, a double-quote is represented by %22 and so on (where numbers are the hex value of the ascii value), see https://en.wikipedia.org/wiki/Percent-encoding for more details.

Try it by pasting the log line into an onine urldecoder such as https://meyerweb.com/eric/tools/dencoder/ and you get back to the original form. But beware that if you test this manually in your browser it should be just fine to paste the urlendoced version as-is.

The fact that the log removes the plus you put in front of some of your terms suggests that you are already using q.op=AND so that the plus is implicit?

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 2. des. 2018 kl. 04:24 skrev Surender Reddy <su...@swooptalent.com>:
> 
> HI,
>   We have upgraded Our Solr from 4.7.3 to 7.5.0 . The query that we are sending to Solr was working in fine in 4.7.3 but failing in 7.5.0.
>   When we noticed , Space in Query is getting replaced by + and causing issue . If we replace extra + with space in the query and executing from Admin UI , it is working fine. Can someone help how to resolve this issue? Appreciate your help!
> 
> Query we are sending to Solr:
> 
> +displayNameWords:[2 TO 5] +((+preferredLocationCountry:"United States" +preferredLocationState:Alabama)) +((+(allContents:java^10.0 allContents:eclipse allContents:java-
> 
> Query in Solr log:
> 
> +displayNameWords:[2+TO+5]++((+preferredLocationCountry:"United+States"++preferredLocationState:Alabama))++((+(allContents:java^10.0+allContents:eclipse+allContents:java-
> 
> Thanks,
>  Surender.


Re: Issue with SolrQuery( Adding +) -- Need help urgent

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/1/2018 8:24 PM, Surender Reddy wrote:
> Query we are sending to Solr:
>
>   +displayNameWords:[2 TO 5] +((+preferredLocationCountry:"United States" +preferredLocationState:Alabama)) +((+(allContents:java^10.0 allContents:eclipse allContents:java-

When you say you are "sending" this to Solr... how PRECISELY are you 
sending it?  Browser?  curl?  Some other piece of software?  All of the 
details are extremely important here.

When URL encoding a string, space turns into plus sign.  If you're using 
something that doesn't do the URL encoding for you, then you'll have to 
send %2B if you mean a plus sign and not a space.

Thanks,
Shawn