如何使用Artifactory Query Language执行反向查询?
Artifactory AQL查询修正方案
问题根源
你当前的查询逻辑对所有仓库生效了path不匹配sub_directory/*的限制,导致所有仓库下路径符合sub_directory/*的条目都被过滤,而非只过滤other_top_level_directory仓库下的对应路径条目。
修正后查询逻辑
正确逻辑为仅排除两类条目:一是属于top_level_directory仓库的所有条目,二是属于other_top_level_directory仓库且路径匹配sub_directory/*的条目,单次查询实现代码如下:
curl -u $credentials \ -X POST https://my-artifactory-server.com/artifactory/api/search/aql \ -H content-type:text/plain -d 'items.find({ "$and": [ {"repo" : {"$neq" : "top_level_directory"}}, { "$not": { "$and": [ {"repo" : {"$eq" : "other_top_level_directory"}}, {"path" : {"$match" : "sub_directory/*"}} ] } } ] }).include("repo","path","name","size","modified")'
内容的提问来源于stack exchange,提问作者stacks
相关产品推荐
相关产品推荐

