|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Should be easy: sort by mgnl:lastmodifiedDear Magnolians This _should_ be an easy one, but after an hour of trying and googling my content nodes are still not being sorted by their modification date. My query: /jcr:root/path/to/data//element(*, myDataType) [@owner = 'superuser'] order by MetaData/@mgnl:lastmodified - It does something, because when I leave the order by... away I get a different sort order - But the nodes are definitely not sorted by their modification date. - Also tried with adding ascending and descending -> no effect - "MetaData/@mgnl:lastmodified" seems to be correct because I can filter by this, just not sort Googling for this only returned http://www.mail-archive.com/user-list@.../msg07985.html Has anyone solved this? Thanks. -will ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
|
|
Re: Should be easy: sort by mgnl:lastmodifiedO.k., maybe it is not possible to sort by a value in a subnode with a query because a node can potentially have multiple subnodes and therefore have multiple values to sort by. Of course this is rather stupid for my case. This leaves me with two options: a) set an additional "lastmodified" value in the node itself (in addition to the MetaData) and sort by this value b) query first, then sort the collection with a comparator Both ways are not too sexy... :-( -will On 25.06.2009, at 18:32, Will Scheidegger wrote: > > Dear Magnolians > > This _should_ be an easy one, but after an hour of trying and > googling my content nodes are still not being sorted by their > modification date. > > My query: > > /jcr:root/path/to/data//element(*, myDataType) [@owner = > 'superuser'] order by MetaData/@mgnl:lastmodified > > - It does something, because when I leave the order by... away I get > a different sort order > - But the nodes are definitely not sorted by their modification date. > - Also tried with adding ascending and descending -> no effect > - "MetaData/@mgnl:lastmodified" seems to be correct because I can > filter by this, just not sort > > Googling for this only returned > http://www.mail-archive.com/user-list@.../msg07985.html > > Has anyone solved this? Thanks. > > -will > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <user-list-unsubscribe@...> > ---------------------------------------------------------------- > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
|
|
Re: Should be easy: sort by mgnl:lastmodifiedOn Jun 25, 2009, at 11:32 AM, Will Scheidegger wrote: > This _should_ be an easy one, but after an hour of trying and > googling my content nodes are still not being sorted by their > modification date. > > My query: > > /jcr:root/path/to/data//element(*, myDataType) [@owner = > 'superuser'] order by MetaData/@mgnl:lastmodified > > - It does something, because when I leave the order by... away I get > a different sort order > - But the nodes are definitely not sorted by their modification date. I struggled with this for a while and ended up getting the unsorted list and then sorting programatically :( Tom ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
|
|
Re: Should be easy: sort by mgnl:lastmodifiedI think I found an other way: - Don't limit the search to "myDataType" so you'll get the MetaData nodes too. - sort by @mgnl:lastModified - only accept "myDataType" nodes in the result At least this seems to do the trick for me. -will On 25.06.2009, at 18:52, Thomas Duffey wrote: > > > On Jun 25, 2009, at 11:32 AM, Will Scheidegger wrote: > >> This _should_ be an easy one, but after an hour of trying and >> googling my content nodes are still not being sorted by their >> modification date. >> >> My query: >> >> /jcr:root/path/to/data//element(*, myDataType) [@owner = >> 'superuser'] order by MetaData/@mgnl:lastmodified >> >> - It does something, because when I leave the order by... away I >> get a different sort order >> - But the nodes are definitely not sorted by their modification date. > > I struggled with this for a while and ended up getting the unsorted > list and then sorting programatically :( > > Tom > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <user-list-unsubscribe@...> > ---------------------------------------------------------------- > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
|
|
Re: Should be easy: sort by mgnl:lastmodifiedOn Jun 25, 2009, at 11:57 AM, Will Scheidegger wrote: > I think I found an other way: > > - Don't limit the search to "myDataType" so you'll get the MetaData > nodes too. > - sort by @mgnl:lastModified > - only accept "myDataType" nodes in the result > > At least this seems to do the trick for me. Can you share the query you came up with for this? Tom > On 25.06.2009, at 18:52, Thomas Duffey wrote: > >> >> >> On Jun 25, 2009, at 11:32 AM, Will Scheidegger wrote: >> >>> This _should_ be an easy one, but after an hour of trying and >>> googling my content nodes are still not being sorted by their >>> modification date. >>> >>> My query: >>> >>> /jcr:root/path/to/data//element(*, myDataType) [@owner = >>> 'superuser'] order by MetaData/@mgnl:lastmodified >>> >>> - It does something, because when I leave the order by... away I >>> get a different sort order >>> - But the nodes are definitely not sorted by their modification >>> date. >> >> I struggled with this for a while and ended up getting the unsorted >> list and then sorting programatically :( ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
|
|
Re: Should be easy: sort by mgnl:lastmodifiedSure. In my case, I needed all nodes of the type "printServerSite" in a certain folder, so this worked for me (in JSP tags): <c:set var="queryString" value="/jcr:root/printserver/sites/x-print/ superuser//* order by MetaData/@mgnl:lastmodified descending" /> <cms:query repository="data" query="${queryString}" type="xpath" nodeType="printServerSite" var="sites" /> But of course ordering by MetaData/@mgnl:lastmodified does not make much sense (it works though). Simpler would be: /jcr:root/printserver/sites/x-print/superuser//* order by @mgnl:lastmodified descending But since Xpath is pretty powerful I tried some more and came up with this: /jcr:root/printserver/sites/x-print/superuser//element(*, printServerSite)/MetaData order by @mgnl:lastmodified descending Here, I'm first filtering for a certain node type then get its MetaData and finally order the MetaData nodes. Same result, more than 4x faster. Now, you could even filter for certain attributes in the node too: /jcr:root/printserver/sites/x-print//element(*, printServerSite) [@owner = 'superuser']/MetaData order by @mgnl:lastmodified descending Xpath _is_ very cool. -will On 25.06.2009, at 19:33, Thomas Duffey wrote: > > > On Jun 25, 2009, at 11:57 AM, Will Scheidegger wrote: > >> I think I found an other way: >> >> - Don't limit the search to "myDataType" so you'll get the MetaData >> nodes too. >> - sort by @mgnl:lastModified >> - only accept "myDataType" nodes in the result >> >> At least this seems to do the trick for me. > > Can you share the query you came up with for this? > > Tom > >> On 25.06.2009, at 18:52, Thomas Duffey wrote: >> >>> >>> >>> On Jun 25, 2009, at 11:32 AM, Will Scheidegger wrote: >>> >>>> This _should_ be an easy one, but after an hour of trying and >>>> googling my content nodes are still not being sorted by their >>>> modification date. >>>> >>>> My query: >>>> >>>> /jcr:root/path/to/data//element(*, myDataType) [@owner = >>>> 'superuser'] order by MetaData/@mgnl:lastmodified >>>> >>>> - It does something, because when I leave the order by... away I >>>> get a different sort order >>>> - But the nodes are definitely not sorted by their modification >>>> date. >>> >>> I struggled with this for a while and ended up getting the >>> unsorted list and then sorting programatically :( > > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <user-list-unsubscribe@...> > ---------------------------------------------------------------- > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscribe@...> ---------------------------------------------------------------- |
| Free embeddable forum powered by Nabble | Forum Help |