jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Müller <thomas.muel...@day.com>
Subject Re: SQL-2 Child Axis in order by clause
Date Wed, 04 Nov 2009 13:12:41 GMT
Hi,

You wrote:
order by press.[jnt:translation/jcr:title_en] desc

This is not valid SQL-2 syntax. What about:
order by translation.[jcr:title_en] desc

Regards,
Thomas


On Wed, Nov 4, 2009 at 1:41 PM, Benjamin Papez <jahia.papez@gmail.com> wrote:
> Hello,
>
> my wanted query is like this, which seems to be a valid query from
> specification point of view:
>
> select press.* from [web_templates:pressContainer] as press inner join
> [jnt:translation] as translation on ischildnode(translation, press) where
> contains(press.*, '${searchTerm}') or contains(translation.*,
> '${searchTerm}') order by translation.[jcr:title_en] desc
>
> unfortunately it does not work, because it looks like
> SimpleScoreDocComparator is looking in Lucene documents representing
> pressContainer and not translation (child node).
>
> I saw that Jackrabbit implemented a RelPathScoreDocComparator for use cases
> like mine, but that comparator implementation is not picked with queries
> like the one above. Like Marcel mentioned it is only used when there is a
> relative path in the order by statement.
>
> Now according to JSR-283 specifications it looks like relative path is not
> allowed in the order by statement. That is also why I get the following
> error, trying it:
>
> 2009-11-04 12:42:08,750: ERROR [JCRSQLTag] - InvalidQueryException --->
> [select press.* from [web_templates:pressContainer] as press inner join
> [jnt:translation] as translation on ischildnode(translation, press) inner
> join [nt:file] as file on translation.pdfVersion_en = file.[jcr:uuid] inner
> join [nt:resource] as filecontent on ischildnode(filecontent, file) where
> contains(filecontent.*, 'Europe') order by
> press.[jnt:translation/jcr:title_en] desc] is not valid.
> javax.jcr.query.InvalidQueryException: '/' not allowed in name
>        at
> org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl.checkPropertyName(QueryObjectModelFactoryImpl.java:1032)
>        at
> org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl.propertyValue(QueryObjectModelFactoryImpl.java:668)
>        at
> org.apache.jackrabbit.spi.commons.query.sql2.Parser.parsePropertyValue(Parser.java:425)
>        at
> org.apache.jackrabbit.spi.commons.query.sql2.Parser.parseDynamicOperand(Parser.java:386)
>        at
> org.apache.jackrabbit.spi.commons.query.sql2.Parser.parseOrder(Parser.java:542)
>        at
> org.apache.jackrabbit.spi.commons.query.sql2.Parser.createQueryObjectModel(Parser.java:121)
>        at
> org.apache.jackrabbit.spi.commons.query.sql2.SQL2QOMBuilder.createQueryObjectModel(SQL2QOMBuilder.java:55)
>        at
> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery(QOMQueryFactory.java:69)
>        at
> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery(CompoundQueryFactory.java:67)
>        at
> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:98)
>
>
> Is there another way to achieve my use case?
> Or is there none so far and should I open a JIRA to once make my original
> query work, which seems to be a valid SQL-2 query by specification ? Perhaps
> a patch could check in the JoinQuery for the child node join condition and
> internally when creating the lucene orderings create the relative path if
> the ordering is on the child node ? Or is there a better place to fix that ?
>
> Regards,
> Benjamin
>
>
> 2009/10/28 Thomas Müller <thomas.mueller@day.com>
>
>> Hi,
>>
>> > I have tried to use a relative path, but I was getting
>> > syntax errors in SQL-2.
>>
>> Could you tell me the exact statement you have used and the exception
>> message and stack trace?
>>
>> Regards,
>> Thomas
>>
>

Mime
View raw message