Skip navigation
jkmgbrt
Currently Being Moderated

Query for fetching assets with the same ordering as used in DAM

Mar 6, 2013 6:04 AM

Tags: #search #5.5 #crx #dam

We are using the QueryBuilder API and are trying to write a query that should return assets ordered by the same order as they have in the DAM (i.e. by the index number shown in the leftmost column when viewing the assets underneath a folder in the DAM). If we do not specify an "order by" predicate the assets are ordered ascending by last modified date. Looking at the asset nodes in CRX, they don´t seem to have any property containing the index which could be used for such an ordering. Is such a query possible to write?

 

Thanks

Joakim

 
Replies
  • Currently Being Moderated
    Mar 6, 2013 8:16 AM   in reply to jkmgbrt

    I don't think there is any special predicate to do that, Code is simply getting all children of given asset and returning them (Offcource there is some ordering logic). If You want exact informaiton I would suggest to use json call that DAM is making i.e.

     

    HOST:POST/<PATH OF DAM>.assets.json

     

    Or decompile AssetListServlet.java ans see how it is implemeted

     

    Yogesh

    www.wemblog.com

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 11:52 PM   in reply to jkmgbrt

    Hi Joakim

     

    i'm pretty sure (without decompiling) that the AssetListServlet "lists" the children of the node (resolver.listChildren(res)) - this would give you the natural order (which is used in the DAM admin).

     

    so to your last question: no - it is not possible to write such a query - and it is not necessary ;-).

     

    Anyway - using the given hierarchy in crx and accessing the stuff direct with the JCR api's without querying is always the prefered (optimized) way to get content out of the repository.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 14, 2013 1:06 AM   in reply to jkmgbrt

    If you want to list assets of a given folder in the order they appear in the DAM admin, do not use a query! Use either the JCR API or the Sling Resource API, as the first one returns the children in the order they are saved in teh Repository, and the Sling API only abstracts from the nodes, but does not change the ordering.

     

    In general do not write a query in that case. The performance penalty compared to simple using JCR API might be very high, especially with large repositories.

     

    Jörg

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points