How to Use Artifactory Query Language (AQL) to Sort on Properties?

How to Use Artifactory Query Language (AQL) to Sort on Properties?

AuthorFullName__c
JFrog Support
articleNumber
000001554
ft:sourceType
Salesforce
FirstPublishedDate
2016-10-06T13:35:56Z
lastModifiedDate
2024-03-10T07:47:59Z
VersionNumber
16

In Artifactory Query Language (AQL), sorting on properties is not an option. However, you can run the following query, which will find artifacts based on specific properties and display these in the returned
 

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

If you would like to focus on a specific property, use this query:
items.find(
{
"@build.name":{"$match":"property value"},
"@build.number":{"$match":"property value"}
}).include("name", "repo", "path", "created","@build.name","@build.number")

Finally, the following .include command query will find everything that matches build.name and build.number:
items.find(
{
"@build.name":{"$match":"maven-artifactory-build"},
"@build.number":{"$match":"123"}
}).include("name", "repo", "path", "created","@build.name","@build.number")

Thereafter, it will output a list of items collected from those fields, as follows:
{
    "results": [
        {
            "repo": "libs-release-local",
            "path": "com/testing/jfrog/maventest/1.0.0",
            "name": "maventest-1.0.0.war",
            "created": "2020-10-11T14:23:56.927Z",
            "properties": [
                {
                    "key": "build.number",
                    "value": "123"
                },
                {
                    "key": "build.name",
                    "value": "maven-artifactory-build"
                }
            ]
        },
        {
            "repo": "libs-release-local",
            "path": "com/testing/jfrog/maventest/1.0.0",
            "name": "maventest-1.0.0.pom",
            "created": "2020-10-11T14:23:57.672Z",
            "properties": [
                {
                    "key": "build.number",
                    "value": "123"
                },
                {
                    "key": "build.name",
                    "value": "maven-artifactory-build"
                }
            ]
        }
    ],
    "range": {
        "start_pos": 0,
        "end_pos": 2,
        "total": 2
    }
}