jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Papez <jahia.pa...@gmail.com>
Subject Re: SQL-2 Child Axis in order by clause
Date Wed, 04 Nov 2009 16:19:40 GMT
Hello Thomas,

thanks again, but thats exactly what I was talking about in my comment.
Please read it carefully.

I already wrote why " order by translation.[jcr:title_en] desc " does not
work.

Then I explained why I tried using a relative path and that this seems not
to be a valid SQL-2 syntax.

And at last I am talking about a possible patch, so I would be happy if you
could answer to my questions in my previous comment.

Regards,
Benjamin


2009/11/4 Thomas Müller <thomas.mueller@day.com>

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message