How to sort search results by multiple fields

cancel
Showing results for 
Search instead for 
Did you mean: 
mmmarko
Member II

How to sort search results by multiple fields

{ "query": { "query": "(TYPE:'some:type' or TYPE:'another:type') and PARENT:'workspace://SpacesStore/some-node-id'" }, "paging": { "maxItems": "100", "skipCount": "0" }, "include": [ ], "fields": [ "name", "nodeType", "modifiedAt", "createdAt" ], "sort": [ {"type":"SCORE", "field":"cm:folder", "ascending":"false"}, {"type":"FIELD", "field":"cm:name", "ascending":"true"} ] }

I am trying to retrieve some custom folder types and custom document types from a folder, and sort them first by isFolder and then by name(or createdAt or modifiedAt). Alfresco full text search works fine when i have only one sorting parameter but when i add a second one the results become weird. I am using postman for testing.

Basically i am trying to retrieve the nodes in the same order as they are shown on Alfresco Share but i haven't been able to do so yet. I have tried lucene and cmis searches as well but no luck there either. I must be doing something wrong but i cant seem to be able to figure out what.

How do i write the request body in such a way that the returned nodes are in proper order?