Sort Documents listing

18 views
Skip to first unread message

Patrik Dusek

unread,
Feb 19, 2020, 3:35:10 AM2/19/20
to dotCMS User Group
Hi All,
I've created a vtl for displaying the file contents of a folder. But I can't get any sort order to work.
#set($_qk = "+(structureName:Document structureName:FileAsset) +confolder:$!{folder}*")

#set($results = $dotcontent.pull(${_qk},$results,"Document.sortOrder asc"))

Every file in the folder has its sort order entry but for some reason the results are never sorted.
Any hints?
Best,
Patrik

Will Ezell

unread,
Feb 19, 2020, 9:07:06 AM2/19/20
to dot...@googlegroups.com
Patrik:

dotCMS uses elasticsearch to sort content.  I would make sure that the field you are sorting on is marked as "system indexed".



--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/ad837b72-f148-4820-881b-d1b2b37cbf79%40googlegroups.com.


--



382 NE 191st St #92150
Miami, Florida 33179-3899
Main: 
305-900-2001 | Direct: 978.294.9429

   

Patrik Dusek

unread,
Feb 19, 2020, 9:49:58 AM2/19/20
to dotCMS User Group
Hi Will,
thx for the response. But its the document which is already shipped with the standard installation and the property for system indexed is checked.
Any other hints?
thx,
Patrik

Will Ezell

unread,
Feb 19, 2020, 10:03:37 AM2/19/20
to dot...@googlegroups.com
Ah, you are trying to sort on two different content types.  Are they both fileAssets?  If they are you could try sorting on just sortOrder, e.g.
#set($results = $dotcontent.pull(${_qk},$results,"sortOrder asc"))

If not, then you will need to pull the list and sort it after the fact in velocity, using the $sorttool:
https://dotcms.com/docs/latest/sorter-viewtool 

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.

Falzone, Chris

unread,
Feb 19, 2020, 10:05:46 AM2/19/20
to dot...@googlegroups.com
A couple things I noticed .. 
1) you are pulling 2 structures but only sorting on one of them -- you probably need to add a secondary sort order for the FileAsset Contentlets.  Which, I am not sure works in dotCMS, you may have to sort after the pull using the sortTool.  
2) in your pull you are passing $results as the limit, that seems wrong, maybe just 0 for all?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.


--


Christopher Falzone / Web Developer
https://aquent.com

[ AQUENT ]


Patrik Dusek

unread,
Feb 19, 2020, 10:41:03 AM2/19/20
to dotCMS User Group
Hi Chris,
you saved my day :) Indeed I had to add the second sort order for fileAsset. Now it works.
thx,
Patrik

Patrik Dusek

unread,
Feb 19, 2020, 10:45:05 AM2/19/20
to dotCMS User Group
Hi Will,
thx for your tip. But for some reason if I only add sortOrder asc the list fails but if I add Document.sortOrder and FileAsset.sortOrder it works correctly. (like Chris suggested)
thx,
Patrik   

Will Ezell

unread,
Feb 19, 2020, 10:52:22 AM2/19/20
to dot...@googlegroups.com
Glad to hear it!  Chris is the man!  

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages