【发布时间】:2021-09-20 20:51:41
【问题描述】:
在 Artfactory 中,我有一个“repo”属性列表,其中一些带有“path”属性。我需要找到与这些属性不匹配的所有项目。我想知道是否有一种方法可以构建我的逻辑,以便可以在一个查询中完成。
这是我当前的错误逻辑:
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"}},
{
"$and": [
{"repo" : {"$neq" : "other_top_level_directory"}},
{"path" : {"$nmatch" : "sub_directory/*"}}
]
}
]
}).include("repo","path","name","size","modified")'
问题在于,虽然“repo”属性是唯一的,但“path”属性却不是。因此,所有子目录都将从查询结果中排除。
【问题讨论】:
-
可以使用德摩根定律进行反转。但是,尚不清楚您想要实现什么。请严格说明您想在查询中找到什么以及您要反转的原始查询是什么?
-
我想反转一个查询,以查找 Artifactory 中具有“repo”属性“top_level_directory”或“repo”属性“other_top_level_directory”和“path”属性“sub_directory/”的所有项目*”。这可能看起来像这样:
or { repo == "top_level_directory", and { repo == "other_top_level_directory", path == "sub_directory/*" } }我正在寻找的是此查询未找到的每个项目。据我所知,Artifactory 没有 NOT 或 NOR 逻辑,这让事情变得更加困难。
标签: artifactory artifactory-query-lang