Open Marcono1234 opened 3 years ago
Hi @Marcono1234 check out https://github.com/sonatype-nexus-community/search-maven-org/issues/149 it is related. You should be able to sort on the following fields score desc,timestamp desc,g asc,a asc,v desc
but I don't think you can.
The solr documentation provides more information.
What are you trying to do?
Get the latest version of an artifact using the REST API https://search.maven.org/solrsearch
It appears that artifact versions are ordered by name, not by release date. E.g.
commons-io:commons-io
has a version20030203.000550
released in 2005, the latest version is currently2.8.0
released in 2020.While
20030203.000550
is a higher version according to the Maven Version Order Specification, it does not indicate anything about the release date.Yet the API documentation at https://search.maven.org/classic/#api says "most recent version released", similarly the API response field is called
latestVersion
. However it actually returns the highest version, e.g. forcommons-io
that is20030203.000550
.Example API requests:
Interestingly https://search.maven.org/solrsearch/select?q=g:%22commons-io%22+AND+a:%22commons-io%22&core=gav&rows=25&wt=json does sort by release date and not version name (though this is not clearly documented).
How could we solve this issue? (Not knowing is okay!)
There are probably multiple ways to solve this:
2.x
and3.x
but the application would always like the3.x
artifact be returned as latest, even if a2.x
artifact was published more recently.sort
field, but I was not able to overwrite that.)Anything else?
Other projects depending on the API might have to be updated, e.g.: https://github.com/softwaremill/maven-badges