You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kurz Wolfgang <wo...@gwvs.de> on 2009/03/31 16:01:05 UTC

How to implement LIKE statements with Xpath?

Hello everyone,

i am implementing a full textual search with xpath.

So far I have been using contains(.,"SearchString") but it doesn’t really get me the right results.

What I would like to have is a LIKE statement like in SQL

So for example if I am searching for "test"

I want the result to return everything that has test in it like test1, test2, test3

I thought contains would do that but apparently it doesn’t:-)

Anyone have an idea for me how I could get this to work?

Thx a lot in advance!

Wolfgang


Re: How to implement LIKE statements with Xpath?

Posted by Marcel Reutegger <ma...@gmx.net>.
On Tue, Mar 31, 2009 at 16:01, Kurz Wolfgang <wo...@gwvs.de> wrote:
> I want the result to return everything that has test in it like test1, test2, test3
>
> I thought contains would do that but apparently it doesn’t:-)

if you want contains() to match prefixes you need to tell it to do so
by using a wildcard:

contains(., "test*")

regards
 marcel

Re: How to implement LIKE statements with Xpath?

Posted by Dennis van der Laan <d....@rug.nl>.
Hi Kurz,

This should work using jcr:like instead of jcr:contains. So using 
jcr:like(., "test%") should return everything starting with 'test'.

Best regards,
Dennis
> Hello everyone,
>
> i am implementing a full textual search with xpath.
>
> So far I have been using contains(.,"SearchString") but it doesn’t really get me the right results.
>
> What I would like to have is a LIKE statement like in SQL
>
> So for example if I am searching for "test"
>
> I want the result to return everything that has test in it like test1, test2, test3
>
> I thought contains would do that but apparently it doesn’t:-)
>
> Anyone have an idea for me how I could get this to work?
>
> Thx a lot in advance!
>
> Wolfgang
>
>   


-- 
Dennis van der Laan