9 Replies Latest reply on Sep 20, 2010 12:27 PM by AmandaS

    Sorting Documents

      Is there a way to control how documents are sorted in a sub-community page?  Right now the list of docs are sorted by date modified, but I would like to sort them by popularity.  I also only want to do it on certain pages (FAQ sub-page, for example).  Is there a macro/plugin already out there or is there a way to set this through the console that I can't find?

        • Re: Sorting Documents

          I'm going to investigate this today to see if I can find a simple solution for you.

           

           

          Regards,

           

          Bruce Ritchie

          • Re: Sorting Documents

            Currently the sorting of the results is defined in the c.j.clearspace.action.CommunityAction class in the getThreadResultFilter, getDocumentResultFilter and getBlogPostResultFilter. It looks like from that class that the sort order is either the default or is explicitly being set to modification date.

             

            The best way around this is via a plugin that overrides that action and returns the results in the order that you would like. Some ordering (such as popularity) would not be possible directly via the api - you'd have to build up a list of documents and sort the list with a comparator that knew how to sort by popularity.

             

            A good place to start writing this plugin is the

             

             

            Regards,

             

            Bruce Ritchie

            • Re: Sorting Documents
              nick

              Providing a little more information here.

               

              It is possible to modify the action via a small customization and change the default sort from modification date to title, as Bruce suggested. What you probably want to avoid in 4.5 is providing a user toggle to change the sort, as that can cause the cache to be thrashed which might hurt performance.

               

              We are adding a completely new browsing API in 5.0 which will allow you to filter content by type and sort by activity, date, and title. I'd recommend waiting for that unless this functionality is critical for your deployment.

              • Re: Sorting Documents

                There's an idea posted for this that you may want to vote on: Sorting documents