-
Type:
Bug
-
Status: Open
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: AQL
-
Labels:None
-
Location:External
In an AQL search using the "/artifactory/api/search/aql" REST API end point, when the .include() function contains the reference of a property, the search capability seems to be ignored as the results are not returned in the expected order.
Artifactory version tested: 7.21.7
Example of a command without a property in the .include() function:
curl -H "Authorization: Bearer $JFROG_ACCESSTOKEN" -s \ -X POST $JFROG_URL/artifactory/api/search/aql \ -H 'Content-Type: text/plain' \ -d 'items.find({"type":"file","repo":"acme-test-local","name":{"$match":"beta_0.3.0*.deb"}}).include("path","name","created").sort({"$desc":["created"]})'
Results, correctly sorted, as expected:
{ "results" : [ { "path" : "pool/main/b", "name" : "beta_0.3.0_all.deb", "created" : "2021-09-13T20:37:07.276Z" } , { "path" : "pool/main/b", "name" : "beta_0.3.0-dev.30.blah_all.deb", "created" : "2021-09-13T20:37:06.365Z" } ], "range" : { "start_pos" : 0, "end_pos" : 2, "total" : 2 } }
The same command, but with a property added to the AQL .include() function:
curl -H "Authorization: Bearer $JFROG_ACCESSTOKEN" -s \ -X POST $JFROG_URL/artifactory/api/search/aql \ -H 'Content-Type: text/plain' \ -d 'items.find({"type":"file","repo":"acme-test-local","name":{"$match":"beta_0.3.0*.deb"}}).include("path","name","created","@svc").sort({"$desc":["created"]})'
Results, incorrect, not sorted by "creation date" in descending order anymore:
{ "results" : [ { "path" : "pool/main/b", "name" : "beta_0.3.0-dev.30.blah_all.deb", "created" : "2021-09-13T20:37:06.365Z", "properties" : [ { "key" : "svc", "value" : "beta" } ] },{ "path" : "pool/main/b", "name" : "beta_0.3.0_all.deb", "created" : "2021-09-13T20:37:07.276Z", "properties" : [ { "key" : "svc", "value" : "beta" } ] } ], "range" : { "start_pos" : 0, "end_pos" : 2, "total" : 2 } }