AI OnAI Off
The query is run in the Search and Navigation service, it does not have access to your code but only what has been indexed. So you either need to fetch all items and do the sorting locally. This is a bad option. Or you need to index this value as well, and update it when the likes increase. This is the better option.
To display a list of pages, we built up a query and following is a part of it.
Strangely, it does not sort the results in descending order of the likecount.
However, for another filteration, it does work. The difference here is LikeCount probably returns values on the fly. Meaning it's defined as follows in the blog page.
and finally the result retrieved
Is this a limitation of Search and Navigation ? Is there a workaround ?