Using AQL With Virtual Repositories

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

AQL supports virtual repositories. Since virtual repositories only contain items indirectly through the local repositories they include, several conventions have been laid down as described in the following sections.

Searching for Items in a Virtual Repository

You may limit queries to search in a specified virtual repository. Since virtual repositories can indirectly contain both local and remote repositories, this means the query will be applied to local repositories and remote repository caches included in the specified virtual repository.

For example, to find all the items within any repository contained in a virtual repository called my-virtual, you would run the following query:

items.find({"repo" : "my-virtual"})

Running the above query will return the items from local repositories and remote-cache repositories associated with the remote repositories assigned to the specified virtual repository.

If the virtual repository contains a Smart Remote repository, you can use the .transitive() tag, so that the results will also list items residing on a remote Artifactory instance. For example:

items.find({"repo" : "my-virtual"}).transitive()

Output Fields

The item domain has a virtual_repos field which includes the virtual repositories in which a found item is contained. In general, to display this field, you need to expressly specify it in your query as an output field. However, if your query specifies a virtual repository as its search target, the virtual_repos field is implicitly included in the search results as an output field.

An item must be accessible in order to be found

A search query will only find an item in a virtual repository if it is accessible by that virtual repository. For example, the local repository that contains an item may specify and include or exclude pattern which prevents access to the item by the encapsulating virtual repository. In this case the search query will not find the item.