You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Raphaël Franchet <ra...@anyware-tech.com> on 2005/09/19 10:44:49 UTC

jcr:like and namespaces

Hello,

I have got a strange behavior with the jcr:like function:

createQuery("//*[@jcr:primaryType='myns:contentLanguage']"... OK
createQuery("//*[jcr:like(@jcr:primaryType, '%:contentLanguage')]"... OK

but as soon as I use namespaces in jcr:like,

createQuery("//*[jcr:like(@jcr:primaryType, '%ns:contentLanguage')]"... KO
createQuery("//*[jcr:like(@jcr:primaryType, 'myns:contentLanguage')]"... KO

is this a known limitation between jcr:like and namespaces ?

Thanks

ps: I'm using the HEAD version
-- 

Raphaël FRANCHET
IT
ANYWARE TECHNOLOGIES
Tel: +33 (0)5 61 00 73 47
Fax : +33 (0)5 61 00 51 46
www.anyware-tech.com

Re: jcr:like and namespaces

Posted by Raphaël Franchet <ra...@anyware-tech.com>.
Yes, you're right.

My revision is 289272. I'm gonna update and test if the ItemNotFound 
still leads to an NPE.

thank you for your help Marcel,

regards,
Raphaël

Marcel Reutegger a écrit :
> Raphaël Franchet wrote:
> 
>> Fine, this error was actually due to a corrupted repository:
>> I had in my console: ...ItemNotFound..(node...)...
>>
>> Maybe the ItemNotFound should had been logged? instead of printed ?
> 
> 
> this probably depends on your log4j configuration. I don't think we have 
> hardcoded log messages that go to standard / error out.
> 
> regards
>  marcel

Re: jcr:like and namespaces

Posted by Marcel Reutegger <ma...@gmx.net>.
Raphaël Franchet wrote:
> Fine, this error was actually due to a corrupted repository:
> I had in my console: ...ItemNotFound..(node...)...
> 
> Maybe the ItemNotFound should had been logged? instead of printed ?

this probably depends on your log4j configuration. I don't think we have 
hardcoded log messages that go to standard / error out.

regards
  marcel

Re: jcr:like and namespaces

Posted by Raphaël Franchet <ra...@anyware-tech.com>.
Fine, this error was actually due to a corrupted repository:
I had in my console: ...ItemNotFound..(node...)...

Maybe the ItemNotFound should had been logged? instead of printed ?

Everything is ok now.

thanks you Marcel,

Raphael

Marcel Reutegger a écrit :
> this should definitively not happen, though I was not able to reproduce 
> it on my jackrabbit checkout.
> 
> I have a vague idea what may cause the exception, but I'm not sure if 
> the change I have committed solves the issue. svn revision is: 290665
> 
> could you please check the logs for error messages that say something 
> like: "Exception while sorting nodes in document order: ..."
> 
> I'm particularly interested in the catched exception there.
> 
> thanks.
> 
> regards
>  marcel
> 
> Raphaël Franchet wrote:
> 
>> Thank you Marcel,
>>
>> In fact, I was just testing jcr:like with jcr:primaryType but I don't 
>> need it on NAME properties.
>>
>> Therefore, I think I found a bug: tell me if I should open it
>>
>> queryManager.createQuery("//*[jcr:like(@jcr:primaryType, '%')]", 
>> Query.XPATH);
>>
>> gives me:
>>
>> Caused by: java.lang.NullPointerException
>> at 
>> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.initOrderedIterator(DocOrderNodeIteratorImpl.java:170) 
>>
>> at 
>> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.hasNext(DocOrderNodeIteratorImpl.java:135) 
>>
>>
>> -- 
>> regards,
>>
>> Raphaël
>>
>> Marcel Reutegger a écrit :
>>
>>> Hi Raphaël,
>>>
>>> the jcr:like function is acutally not meant to be used with NAME
>>> properties because it is not required by the spec (see section 6.6.3.3).
>>> your second statement example works because the index structure is able
>>> to handle this specific jcr:like expression, but it does not support it
>>> in general as you have noticed with the last two statements.
>>>
>>> please post a jira enhancement request if you feel this is a feature
>>> that should be included in jackrabbit.
>>>
>>> regards
>>>  marcel
>>>
>>> Raphaël Franchet wrote:
>>>
>>>> Hello,
>>>>
>>>> I have got a strange behavior with the jcr:like function:
>>>>
>>>> createQuery("//*[@jcr:primaryType='myns:contentLanguage']"... OK
>>>> createQuery("//*[jcr:like(@jcr:primaryType, 
>>>> '%:contentLanguage')]"... OK
>>>>
>>>> but as soon as I use namespaces in jcr:like,
>>>>
>>>> createQuery("//*[jcr:like(@jcr:primaryType, 
>>>> '%ns:contentLanguage')]"... KO
>>>> createQuery("//*[jcr:like(@jcr:primaryType, 
>>>> 'myns:contentLanguage')]"... KO
>>>>
>>>> is this a known limitation between jcr:like and namespaces ?
>>>>
>>>> Thanks
>>>>
>>>> ps: I'm using the HEAD version
>>>
>>>
>>>
>>>
>>
>>

Re: jcr:like and namespaces

Posted by Marcel Reutegger <ma...@gmx.net>.
this should definitively not happen, though I was not able to reproduce 
it on my jackrabbit checkout.

I have a vague idea what may cause the exception, but I'm not sure if 
the change I have committed solves the issue. svn revision is: 290665

could you please check the logs for error messages that say something 
like: "Exception while sorting nodes in document order: ..."

I'm particularly interested in the catched exception there.

thanks.

regards
  marcel

Raphaël Franchet wrote:
> Thank you Marcel,
> 
> In fact, I was just testing jcr:like with jcr:primaryType but I don't 
> need it on NAME properties.
> 
> Therefore, I think I found a bug: tell me if I should open it
> 
> queryManager.createQuery("//*[jcr:like(@jcr:primaryType, '%')]", 
> Query.XPATH);
> 
> gives me:
> 
> Caused by: java.lang.NullPointerException
> at 
> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.initOrderedIterator(DocOrderNodeIteratorImpl.java:170) 
> 
> at 
> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.hasNext(DocOrderNodeIteratorImpl.java:135) 
> 
> 
> -- 
> regards,
> 
> Raphaël
> 
> Marcel Reutegger a écrit :
> 
>> Hi Raphaël,
>>
>> the jcr:like function is acutally not meant to be used with NAME
>> properties because it is not required by the spec (see section 6.6.3.3).
>> your second statement example works because the index structure is able
>> to handle this specific jcr:like expression, but it does not support it
>> in general as you have noticed with the last two statements.
>>
>> please post a jira enhancement request if you feel this is a feature
>> that should be included in jackrabbit.
>>
>> regards
>>  marcel
>>
>> Raphaël Franchet wrote:
>>
>>> Hello,
>>>
>>> I have got a strange behavior with the jcr:like function:
>>>
>>> createQuery("//*[@jcr:primaryType='myns:contentLanguage']"... OK
>>> createQuery("//*[jcr:like(@jcr:primaryType, '%:contentLanguage')]"... OK
>>>
>>> but as soon as I use namespaces in jcr:like,
>>>
>>> createQuery("//*[jcr:like(@jcr:primaryType, 
>>> '%ns:contentLanguage')]"... KO
>>> createQuery("//*[jcr:like(@jcr:primaryType, 
>>> 'myns:contentLanguage')]"... KO
>>>
>>> is this a known limitation between jcr:like and namespaces ?
>>>
>>> Thanks
>>>
>>> ps: I'm using the HEAD version
>>
>>
>>
> 
> 

Re: jcr:like and namespaces

Posted by Raphaël Franchet <ra...@anyware-tech.com>.
Thank you Marcel,

In fact, I was just testing jcr:like with jcr:primaryType but I don't 
need it on NAME properties.

Therefore, I think I found a bug: tell me if I should open it

queryManager.createQuery("//*[jcr:like(@jcr:primaryType, '%')]", 
Query.XPATH);

gives me:

Caused by: java.lang.NullPointerException
at 
org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.initOrderedIterator(DocOrderNodeIteratorImpl.java:170)
at 
org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.hasNext(DocOrderNodeIteratorImpl.java:135)

--
regards,

Raphaël

Marcel Reutegger a écrit :
> Hi Raphaël,
> 
> the jcr:like function is acutally not meant to be used with NAME
> properties because it is not required by the spec (see section 6.6.3.3).
> your second statement example works because the index structure is able
> to handle this specific jcr:like expression, but it does not support it
> in general as you have noticed with the last two statements.
> 
> please post a jira enhancement request if you feel this is a feature
> that should be included in jackrabbit.
> 
> regards
>  marcel
> 
> Raphaël Franchet wrote:
> 
>> Hello,
>>
>> I have got a strange behavior with the jcr:like function:
>>
>> createQuery("//*[@jcr:primaryType='myns:contentLanguage']"... OK
>> createQuery("//*[jcr:like(@jcr:primaryType, '%:contentLanguage')]"... OK
>>
>> but as soon as I use namespaces in jcr:like,
>>
>> createQuery("//*[jcr:like(@jcr:primaryType, 
>> '%ns:contentLanguage')]"... KO
>> createQuery("//*[jcr:like(@jcr:primaryType, 
>> 'myns:contentLanguage')]"... KO
>>
>> is this a known limitation between jcr:like and namespaces ?
>>
>> Thanks
>>
>> ps: I'm using the HEAD version
> 
> 

Re: jcr:like and namespaces

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Raphaël,

the jcr:like function is acutally not meant to be used with NAME
properties because it is not required by the spec (see section 6.6.3.3).
your second statement example works because the index structure is able
to handle this specific jcr:like expression, but it does not support it
in general as you have noticed with the last two statements.

please post a jira enhancement request if you feel this is a feature
that should be included in jackrabbit.

regards
  marcel

Raphaël Franchet wrote:
> Hello,
> 
> I have got a strange behavior with the jcr:like function:
> 
> createQuery("//*[@jcr:primaryType='myns:contentLanguage']"... OK
> createQuery("//*[jcr:like(@jcr:primaryType, '%:contentLanguage')]"... OK
> 
> but as soon as I use namespaces in jcr:like,
> 
> createQuery("//*[jcr:like(@jcr:primaryType, '%ns:contentLanguage')]"... KO
> createQuery("//*[jcr:like(@jcr:primaryType, 'myns:contentLanguage')]"... KO
> 
> is this a known limitation between jcr:like and namespaces ?
> 
> Thanks
> 
> ps: I'm using the HEAD version