Hi, On Wed, Nov 4, 2009 at 13:41, Benjamin Papez <[email protected]> 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).
that sounds like a bug. could you please file a jira issue? thanks. regards marcel > 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 <[email protected]> > >> 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 >> >
