You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Runar Espeland <Ru...@forsta.com.INVALID> on 2024/05/14 12:40:58 UTC
Solr parsing query: Non ended comments inside comment does not work as expected
Solr parsing non-ended comments inside comment, does not work as expected.
If there are non-ended comments inside a comment. Then it will treat trailing words as comments
Examples
samsung /* Motorola iphone */ -- > works. As expected
samsung /* motorola /* iphone */ ) --> works. Not as expected. Ignores trailing ')'
( samsung /* motorola /* iphone */ nokia ) -- > fails. Not as expected. Because of starting '('. Ended ')' is ignored. Since it is read as a comment.
Is this a bug ?
Versions:
Solr-spec 8.11.1
Lucene-spec 8.11.1
Re: Solr parsing query: Non ended comments inside comment does not work as expected
Posted by Yonik Seeley <ys...@gmail.com>.
It's either a feature (best-effort forgiving parsing) or a bug (number of
comment closes do not match number of opens
and we should return an error.) Unlike C, Solr supports nested comments.
Both of your examples have two
comment starts, but only one end, hence the entire string is commented from
the first "/*".
-Yonik
On Thu, May 16, 2024 at 3:01 PM Runar Espeland
<Ru...@forsta.com.invalid> wrote:
> Solr parsing non-ended comments inside comment, does not work as expected.
> If there are non-ended comments inside a comment. Then it will treat
> trailing words as comments
>
> Examples
> samsung /* Motorola iphone */ -- > works. As expected
> samsung /* motorola /* iphone */ ) --> works. Not as expected. Ignores
> trailing ')'
> ( samsung /* motorola /* iphone */ nokia ) -- > fails. Not as expected.
> Because of starting '('. Ended ')' is ignored. Since it is read as a
> comment.
>
>
> Is this a bug ?
>
> Versions:
> Solr-spec 8.11.1
> Lucene-spec 8.11.1
>
Re: Solr parsing query: Non ended comments inside comment does not work as expected
Posted by Shawn Heisey <ap...@elyograg.org.INVALID>.
On 5/14/24 06:40, Runar Espeland wrote:
> Solr parsing non-ended comments inside comment, does not work as expected.
> If there are non-ended comments inside a comment. Then it will treat trailing words as comments
>
> Examples
> samsung /* Motorola iphone */ -- > works. As expected
> samsung /* motorola /* iphone */ ) --> works. Not as expected. Ignores trailing ')'
> ( samsung /* motorola /* iphone */ nokia ) -- > fails. Not as expected. Because of starting '('. Ended ')' is ignored. Since it is read as a comment.
If you are trying to search for actual parenthesis characters, you need
to escape them with a backslash. Parentheses are a special character in
Solr queries used for overriding the query operator parsing order.
Same goes for the asterisk character. It is a special character used
for wildcard searching, so if you want to actually match an asterisk
character, you have to escape it.
Thanks,
Shawn