artifactoryartifactory-query-lang

How to change the include section of an AQL query in a file spec


I want to change the output of a AQL string formatted as a file spec for Artifactory.

The query looks like this:

{
    "files": [
        {
            "aql": {
                "items.find":{
                    "repo":"gradle-dev-local",
                    "$or":[
                        {
                            "$and": [
                                { "stat.downloads": { "$eq":null } },
                                { "updated": { "$before": "7d" } }
                            ]
                        },
                        {
                            "$and": [
                                { "stat.downloads": { "$gt": 0 } },
                                { "stat.downloaded": { "$before": "30d" } }
                            ]
                        }
                    ]
                }
            }
        }
    ]
}

In a pure AQL REST API call, I would include the following:

"include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]

But when used, it does not get passed in to the right part of the query, resulting in the following error message:

Failed to parse query: items.find({  
                    "repo":"mfm-gradle-dev-local",  
                    "$or":[  
                        {  
                            "$and": [  
                                { "stat.downloads": { "$eq":null } },  
                                { "updated": { "$before": "7d" } }  
                            ]  
                        },  
                        {  
                            "$and": [  
                                { "stat.downloads": { "$gt": 0 } },  
                                { "stat.downloaded": { "$before": "30d" } }  
                            ]  
                        }  
                    ]  
                },  
                "include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]  
            ).include("name","repo","path","actual_md5","actual_sha1","size","type","property"), it looks like there is syntax error near the following sub-query:    "include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]

How do I format the AQL so that the include statement gets passed as well?


Solution

  • If you're using the JFrog CLI, there is an open issue (github.com/jfrog/jfrog-cli-go/issues/320) for being able to add includes in the search queries (both using the -s parameter and file specs). Please feel free to add additional information to that issue, if we've missed anything so far.