You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 08:39:03