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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Surender Reddy
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.
Reply | Threaded
Open this post in threaded view
|

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

Jan Høydahl / Cominvent
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 <[hidden email]>:
>
> 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.

Reply | Threaded
Open this post in threaded view
|

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

Shawn Heisey-2
In reply to this post by Surender Reddy
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