Forum Discussion

vidhyut_cisco's avatar
11 years ago

Need search results sorted

Hi,

 

I am using the api "/search/messages?q=${SRIDs}&f=tags&restapi.response_style=view" to search messages in the community. Is there a way to get the results sorted either in ascending or descending order? Thanks.

 

Regards,

Sethuraman.AR

  • AdamA's avatar
    AdamA
    Khoros Oracle

    Hello,

     

    You can use the following query parameter key/value to sort by descending date:

     

    sort_by=-topicPostDate

     For ascending you can remove the '-' from query param value. Here are some other query param values you can use for sorting:

     

    • topicViews
    • topicKudos
    • replies
    • Ordering by (-) topicKudos doens't seem to work.. (querying search/messages). Errocode = 100. Can you please elaborate?

      • ChhamaJ's avatar
        ChhamaJ
        Khoros Staff

        Actually, its topicKudosCount 

        On the other hand, how or by what criteria are you trying to sort the messages? 

         

        Regards,
        Chhama