Indeed, it works.
Thanks for your answer.

The following query doesn't work :

//*[jcr:contains(., '*bi*')]

Why is it so ?

+ [node] node1
       [prop] title = "a new question"
+ [node] node2
       [prop] title = "answer"


Basically, my need is to do the following search :
- search for a string anywhere in a property. For example, with the contents above, searching for 'N' should return both nodes.
  - case insensitive

So jcr:like(%title, "%N%") do the job but is case sensitive. And jcr:contains(%title, "*N*") is not possible.
I'm stuck here.

Do you have an idea ?


Marcel Reutegger (JIRA) wrote:

    [ http://issues.apache.org/jira/browse/JCR-198?page=all ]
Marcel Reutegger resolved JCR-198:
----------------------------------

   Resolution: Invalid

jcr:contains in XPath and CONTAINS in SQL respectively are fulltext extensions 
to the two languages. The specification is not very strict on what exactly is 
supported. It merely defines the fulltext syntax that can be used in the 
contains function. Whether a term matches also a substring is not specified.

It is certainly possible to change the jackrabbit implementation that 
jcr:contains will also match substrings. However, I'm not sure if that is a 
good idea. E.g. if you search for 'bi' on google you don't get whatever starts 
with 'bi'.

What Jackrabbit already supports are wildcards in the jcr:contains function.

To make your query work you can use:
//*[jcr:contains(., 'bi*')]

which will match everything that starts with 'bi' or 'bi' itself.

or use:
//*[jcr:contains(., 'bi?')]

which will match any 3 letter word that starts with 'bi'

Keep in mind that this is not standardized and will probably not work on other 
implementations.

jcr:contains doesn't return incomplete match
--------------------------------------------

        Key: JCR-198
        URL: http://issues.apache.org/jira/browse/JCR-198
    Project: Jackrabbit
       Type: Bug
 Components: query
   Reporter: Bertrand Lega

This behaviour is very strange. I have the following repository : ... + [node] mynode
       [prop] title = "my big title"
the following query doesn't return any node : //*[jcr:contains(@title, "bi")] 
wherea
revision : 234496


        

        
                
___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com

Reply via email to