You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Mark Waschkowski <mw...@gmail.com> on 2007/09/25 00:17:42 UTC

case insensitve searches

Hi,

I saw from earlier messages that there is a function 'fn:lower-case' to
allow searches to be done by making search criteria lower case, but I need
something a bit less constrained. We have data in a repository that has a
title with case, and an input box that our users can input values to search
on (for said title). They may not be sure of the case of the title, so we
need to do a case insensitive search.

ie.
Stored as: "The Big Company"
Input as: Big company

and see a hit in the results. Does jackrabbit support this?

Thanks alot!

Mark

Re: case insensitve searches

Posted by Mark Waschkowski <mw...@gmail.com>.
OK, thanks for the clarification. I've followed your example and works well.
It would be nice to be able to specify case insensitivity for the query as a
whole, rather than having to force case on all values, but maybe I'll
suggest that in a jira...

Thanks again,

Mark

On 9/24/07, Torgeir Veimo <to...@pobox.com> wrote:
>
>
> On 24 Sep 2007, at 23:17, Mark Waschkowski wrote:
>
> > I saw from earlier messages that there is a function 'fn:lower-
> > case' to
> > allow searches to be done by making search criteria lower case, but
> > I need
> > something a bit less constrained. We have data in a repository that
> > has a
> > title with case, and an input box that our users can input values
> > to search
> > on (for said title). They may not be sure of the case of the title,
> > so we
> > need to do a case insensitive search.
> >
> > ie.
> > Stored as: "The Big Company"
> > Input as: Big company
> >
> > and see a hit in the results. Does jackrabbit support this?
>
> The fn:lower-case doesn't necessarily apply to the search string. It
> can apply to the field you're searching, so you'd get exactly what
> you're after.
>
> Eg. I do something like
>
> String queryString = "/jcr:root/nen:content" + path + "//element
> (*,nen:tag)[jcr:like(fn:lower-case(@nen:tag),'" + queryString + "%')]";
>
> The queryString I've already converted to lowercase using plain java
> method.
>
> --
> Torgeir Veimo
> torgeir@pobox.com
>
>
>
>

Re: case insensitve searches

Posted by Torgeir Veimo <to...@pobox.com>.
On 24 Sep 2007, at 23:17, Mark Waschkowski wrote:

> I saw from earlier messages that there is a function 'fn:lower- 
> case' to
> allow searches to be done by making search criteria lower case, but  
> I need
> something a bit less constrained. We have data in a repository that  
> has a
> title with case, and an input box that our users can input values  
> to search
> on (for said title). They may not be sure of the case of the title,  
> so we
> need to do a case insensitive search.
>
> ie.
> Stored as: "The Big Company"
> Input as: Big company
>
> and see a hit in the results. Does jackrabbit support this?

The fn:lower-case doesn't necessarily apply to the search string. It  
can apply to the field you're searching, so you'd get exactly what  
you're after.

Eg. I do something like

String queryString = "/jcr:root/nen:content" + path + "//element 
(*,nen:tag)[jcr:like(fn:lower-case(@nen:tag),'" + queryString + "%')]";

The queryString I've already converted to lowercase using plain java  
method.

-- 
Torgeir Veimo
torgeir@pobox.com