Search code examples
artifactoryartifactory-query-lang

AQL include for multi value property returns only first value


What's the right AQL format to include all values for a multi value property field. Neither @<prop name> nor properties.* seem to work.

When running an AQL query and including a property field which contains multiple values the result contains the first value and not a list containing all values

items.find(...).include("*","@distro")

At present, I run one query to generate a list of artifacts and then iterate through the list running a query for each artifacts properties

f'/api/storage/{artifact.repo}/{artifact.path}/{artifact.name}?properties'

Result

...properties {'key': 'distro', 'value': 'Ubuntu'}

Desired Result

...properties {'key': 'distro', 'value': ['Ubuntu', 'CentOS',...]}

Solution

  • I heard back from jfrog support and the problem seems to be that the use of '@propertyname' allows for the collapse of a potentially multi value property into a single value and this blocks the gathering of all properties.

    A more efficient approach would be

    items.find(...).include("property")
    

    This results in all properties returned in the json payload as it includes the property domain which includes all the properties.

    Additionally, by not using @ the query doesn't collapse the properties from lists of values to a single value. So, if build_number is a property it becomes ['25'] instead of 25.

    When requesting the property domain, be sure to treat each property as a list.