You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@solr.apache.org by Joel Bernstein <jo...@gmail.com> on 2022/07/07 21:18:13 UTC

ClientUtils.escapeQueryChars escaping whitespace?

I was using the ClientUtils.escapeSpecialChars method and was
surprised that white space is being escaped.

https://github.com/apache/solr/blob/main/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java#L186

I was considering removing this but wanted to see if anyone had a reason
for whitespace to be escaped.



Joel Bernstein
http://joelsolr.blogspot.com/

Re: ClientUtils.escapeQueryChars escaping whitespace?

Posted by David Smiley <ds...@apache.org>.
Yeah; agreed with Houston.  I think it's working as designed.

~ David Smiley
Apache Lucene/Solr Search Developer
http://www.linkedin.com/in/davidwsmiley


On Mon, Jul 11, 2022 at 11:40 AM Houston Putman <ho...@apache.org> wrote:

> From my understanding, that method is supposed to basically escape
> characters inside of a term you are trying to query for.
> So since whitespace is not treated as a part of a term in a query string
> (it separates terms to be queried, using the default operator), it has to
> be escaped.
>
> How are you trying to use the method?
>
> On Thu, Jul 7, 2022 at 5:18 PM Joel Bernstein <jo...@gmail.com> wrote:
>
>> I was using the ClientUtils.escapeSpecialChars method and was
>> surprised that white space is being escaped.
>>
>>
>> https://github.com/apache/solr/blob/main/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java#L186
>>
>> I was considering removing this but wanted to see if anyone had a reason
>> for whitespace to be escaped.
>>
>>
>>
>> Joel Bernstein
>> http://joelsolr.blogspot.com/
>>
>

Re: ClientUtils.escapeQueryChars escaping whitespace?

Posted by Houston Putman <ho...@apache.org>.
From my understanding, that method is supposed to basically escape
characters inside of a term you are trying to query for.
So since whitespace is not treated as a part of a term in a query string
(it separates terms to be queried, using the default operator), it has to
be escaped.

How are you trying to use the method?

On Thu, Jul 7, 2022 at 5:18 PM Joel Bernstein <jo...@gmail.com> wrote:

> I was using the ClientUtils.escapeSpecialChars method and was
> surprised that white space is being escaped.
>
>
> https://github.com/apache/solr/blob/main/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java#L186
>
> I was considering removing this but wanted to see if anyone had a reason
> for whitespace to be escaped.
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>