You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Jaka Jaksic <ja...@telemach.net> on 2007/02/09 04:14:46 UTC
Searching "&" character
Hi!
Is it possible to perform a full-text search for a string containing an "&"
character?
For example this query:
//element(*, nt:file)[jcr:contains(., 'Dolce&Gabbana')]
... produces the following error:
Encountered: "G" (71), after : "\'Dolce&"
... presumably because it expects an XML entity following the "&".
However, if I replace the "&" with an "&", the query works, but finds
only literal "&" strings (e.g. "Dolce&Gabbana"), which is useless.
Is there another way to properly escape the "&" character?
Thanks & regards,
Jaka
Re: Searching "&" character
Posted by Marcel Reutegger <ma...@day.com>.
Hi Jaka,
this is a bug in the jackrabbit query handler. it does not decode predefined
entities in string literals before the query is executed.
I've filed a jira issue:
http://issues.apache.org/jira/browse/JCR-739
As a workaround you can replace the & with a ?, which acts as a wildcard in the
contains query string. That's not exactly the same but close ;)
regards
marcel
Jaka Jaksic wrote:
> Hi!
>
> Is it possible to perform a full-text search for a string containing an "&"
> character?
>
> For example this query:
> //element(*, nt:file)[jcr:contains(., 'Dolce&Gabbana')]
>
> ... produces the following error:
> Encountered: "G" (71), after : "\'Dolce&"
>
> ... presumably because it expects an XML entity following the "&".
> However, if I replace the "&" with an "&", the query works, but finds
> only literal "&" strings (e.g. "Dolce&Gabbana"), which is useless.
>
> Is there another way to properly escape the "&" character?
>
>
> Thanks & regards,
> Jaka
>
>