[RTFACT-13508] Adding rpm metadata in 'include' clause breaks sort Created: 26/Jan/17  Updated: 04/Apr/19

Status: Open
Project: Artifactory Binary Repository
Component/s: AQL, REST API, RPM, Search
Affects Version/s: 4.14.2
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Boris Goykhman Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: api, aql, artifactory, search


Sorting of RPMs in a yum repo by created date does not work if 'rpm.metadata.name' and/or 'rpm.metadata.version' are present in 'include' clause. So a call like this

curl --user USER -X POST -H 'Content-type: application/json' ARTIFACTORY_URL/api/search/aql -d 'items.find({"repo":"REPOKEY", "@rpm.metadata.name": "RPMNAME"}).include("name", "@rpm.metadata.name", "@rpm.metadata.version", "created").sort({"$desc":["created"]})'

still returns an unsorted list. But a call like this:

curl --user USER -X POST -H 'Content-type: application/json' ARTIFACTORY_URL/api/search/aql -d 'items.find({"repo":"REPOKEY", "@rpm.metadata.name": "RPMNAME"}).include("name", "created").sort({"$desc":["created"]})'

returns a properly sorted list.

Comment by Simon Walton [ 04/Apr/19 ]

I'd like to add that we have hit what I suspect to be the same issue too trying to obtain a sorted list of docker images:

items.find({"repo":{"$eq":"our-docker-repo"},"@docker.repoName":{"$eq":"jenkins-pipeline-test/jenkins-pipeline-test-test-app"}}).include("name", "repo", "path", "@docker.manifest", "modified", "created").sort({"$asc":["created"]})

 This returns an arbitrarily-sorted list.

Generated at Mon Feb 17 13:58:49 UTC 2020 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.