Hello, > > Thanks Ard, I can use jcr:contains. > But how does it perform better than jcr:like with respect to > performance ?
see thread http://www.mail-archive.com/[EMAIL PROTECTED]/msg06993.html "jcr:like with a '%' prefix" will not perform is a short recapitulation if you are not willing to read all the mails -Ard > > Regards, > Prakash > > Ard Schrijvers wrote: > > Hello, > > > > > >> Prakash Reddy wrote: > >> > > > > > >> I can't do without jcr:like because I need to get all the > nodes whose > >> property's value contains a given word. > >> What are my other alternatives? > >> > > > > A given word in the text of a property....you should really use > > jcr:contains in that case. Can't you use jcr:contains? > > > > -Ard > > > > > >> Thanks in advance. > >> > >> Regards, > >> Prakash > >> > >> Ard Schrijvers wrote: > >> > >>> Hello, > >>> > >>> It may work for you at the moment, but a query like > >>> '//*[jcr:like(fn:lower-case(@propertyName), '%article%')]' is > >>> *extremely* inefficient. using the jcr:like in combination with a > >>> prefix '%' will most certainly lead to very slow results when the > >>> number of hits grows (even for quite small repositories). If you > >>> really need it, and the number of nodes will grow, you > >>> > >> should really > >> > >>> look for a different solution IMO (like using a nodetype > which you > >>> search for) > >>> > >>> Regards Ard > >>> > >>> > >>> > >>>> Alessandro, > >>>> > >>>> Thanks for explaining. Now I understood my mistake. > >>>> The mistake I did was I had uppercase letters in the pattern. > >>>> Thats why I was not getting the expected results. > >>>> After I changed everything to lower case in the pattern, > >>>> > >> everything > >> > >>>> works fine. > >>>> > >>>> Thank you and others once again for helping me out. > >>>> > >>>> Regards, > >>>> Prakash > >>>> > >>>> > >>>> Alessandro Bologna wrote: > >>>> > >>>> > >>>>> Prakash, > >>>>> > >>>>> maybe I am still not understanding, but > >>>>> //*[jcr:like(fn:lower-case(@propertyName), '%article%')] should > >>>>> actually do what you want. The property values are > >>>>> > >>>>> > >>>> converted to lower > >>>> > >>>> > >>>>> case ("MyArtcilexxx", "MyARTicleyyy" => "myartcilexxx", > >>>>> "myarticleyyy") by the lower-case function, and they are > >>>>> > >>>>> > >>>> compared to > >>>> > >>>> > >>>>> the pattern that happens to have lower case characters > >>>>> > >>>>> > >>>> there only (so > >>>> > >>>> > >>>>> you should use lowercase letters on the pattern, of course). > >>>>> > >>>>> Did you try it? > >>>>> > >>>>> Alessandro > >>>>> > >>>>> > >>>>> Prakash Reddy K. L. V. wrote: > >>>>> > >>>>> > >>>>>> Alessandro, > >>>>>> > >>>>>> This does not help. fn:lower-case will just convert the > >>>>>> > >> letters to > >> > >>>>>> lower case. > >>>>>> May be I was not clear in my earlier mail. > >>>>>> I want to retrieve all nodes whose property has values like > >>>>>> "MyArtcilexxx", "MyARTicleyyy", "artcilezzzz" and so on. > >>>>>> I want something like String.equalsIgnoreCase("article") . > >>>>>> > >>>>>> Regards, > >>>>>> Prakash > >>>>>> > >>>>>> Alessandro Bologna wrote: > >>>>>> > >>>>>> > >>>>>>> Yes, > >>>>>>> Try using //*[jcr:like(fn:lower-case(@propertyName), > >>>>>>> > >>>>>>> > >>>> '%article%')] > >>>> > >>>> > >>>>>>> Alessandro > >>>>>>> > >>>>>>> > >>>>>>> Prakash Reddy K. L. V. wrote: > >>>>>>> > >>>>>>> > >>>>>>>> Hi Alessandro, > >>>>>>>> > >>>>>>>> Thanks for your response. > >>>>>>>> The query //*[jcr:like(@propertyName, '%article%')] > >>>>>>>> > >>>>>>>> > >>>> seems to work > >>>> > >>>> > >>>>>>>> for me. But I have a problem here. It seems to be case > >>>>>>>> > >> sensitive. > >> > >>>>>>>> Is there a way to tell jackrabbit to ignore case?? > >>>>>>>> > >>>>>>>> Regards, > >>>>>>>> Prakash > >>>>>>>> > >>>>>>>> > >>>>>>>> Alessandro Bologna wrote: > >>>>>>>> > >>>>>>>> > >>>>>>>>> Hi, > >>>>>>>>> > >>>>>>>>> you can't search for substrings of the node name, but > >>>>>>>>> > >> if you do > >> > >>>>>>>>> store the node name in a property, then you can use either > >>>>>>>>> jcr:like or jcs:contains (not just "contains", the XPATH in > >>>>>>>>> Jackrabbit doesn't support it). > >>>>>>>>> > >>>>>>>>> So try: > >>>>>>>>> //*[jcr:contains(@propertyName,'article')] > >>>>>>>>> or: > >>>>>>>>> //*[jcr:like(@propertyName, '%article%')] > >>>>>>>>> > >>>>>>>>> Further reading here > >>>>>>>>> > >>>>>>>>> > >> http://www.theserverside.com/tt/articles/article.tss?l=JCRPract > >> > >>>>>>>>> and of course the JSR-170 specs. > >>>>>>>>> > >>>>>>>>> Hope it helps. > >>>>>>>>> Alessandro > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Prakash Reddy K. L. V. wrote: > >>>>>>>>> > >>>>>>>>> > >>>>>>>>>> Hi, > >>>>>>>>>> > >>>>>>>>>> I am using jackrabbit as my content repository. > >>>>>>>>>> Is there a way to search for nodes whose name contains a > >>>>>>>>>> particular word using XPath? > >>>>>>>>>> For example I want to search for all the nodes whose name > >>>>>>>>>> contains "article". > >>>>>>>>>> > >>>>>>>>>> I tried this query : /jcr:root/*article* This does > not work. > >>>>>>>>>> > >>>>>>>>>> I also tried storing the name as property of the node > >>>>>>>>>> > >>>>>>>>>> > >>>> and tried > >>>> > >>>> > >>>>>>>>>> this query : > >>>>>>>>>> /jcr:root/[EMAIL PROTECTED]''article"] > >>>>>>>>>> This does not even get those nodes for which the > >>>>>>>>>> > >> value of the > >> > >>>>>>>>>> property is "article". > >>>>>>>>>> > >>>>>>>>>> Is there any other way to achieve this ? > >>>>>>>>>> > >>>>>>>>>> Thanks, > >>>>>>>>>> Prakash > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > >>>> > >>>> > >> > >> > >
