How do I use Artifactory Query Language to sort on properties?

Sorting on properties is not implemented in Artifactory Query Language (AQL) at this time. However, you can run a query that finds artifacts based on specific properties and displays only the desired property in the result:

 

items.find().include(“name”, “repo”, “path”, “created”,”@build.name”,”@build.number”)

 

or if you want a specific property:


items.find(

{

“@build.name”:{“$match”:”property value”},

“@build.number”:{“$match”:”property value”}

}

).include(“name”, “repo”, “path”, “created”,”@build.name”,”@build.number”)


This query finds all the items that have properties: build.name and build.number and displays on the output the fields that are listed in the ‘.include‘ command:


{

  “range”: {

    “end_pos”: 2, 

    “limit”: 1000, 

    “start_pos”: 0

  }, 

  “results”: [

    {

      “created”: “2015-02-27T02:03:00.651+02:00”, 

      “name”: “testThis-1.2.3-20150227.000227-1.aar”, 

      “path”: “com/alex/me/testThis/1.2.3-SNAPSHOT”, 

      “properties”: [

        {

          “key”: “build.name”, 

          “value”: “android_test”

        }, 

        {

          “key”: “build.number”, 

          “value”: “121”

        }

      ], 

      “repo”: “gradle”

    }, 

    {

      “created”: “2015-02-27T02:03:00.741+02:00”, 

      “name”: “app-unspecified.apk”, 

      “path”: “MyApplication/app/unspecified”, 

      “properties”: [

        {

          “key”: “build.name”, 

          “value”: “android_test”

        }, 

        {

          “key”: “build.number”, 

          “value”: “121”

        }

      ], 

      “repo”: “gradle”

    }

  ]

}