clojars / clojars-web

A community repository for open-source Clojure libraries
https://clojars.org
Eclipse Public License 1.0
468 stars 114 forks source link

Search query returns outdated artifact versions #861

Closed rome-user closed 1 year ago

rome-user commented 1 year ago

Consider a query like https://clojars.org/search?format=xml&q=lilactown/helix

At the time of writing this issue, the following data is returned.

<?xml version="1.0" encoding="UTF-8"?>
<results count="1" total-hits="1" results-per-page="24" offset="0">
  <result jar_name="helix"
      group_name="lilactown"
      version="0.0.12"
      description="ClojureScript optimized for modern React development."
      created="1591393718860" />
</results>

However, the latest version of lilactown/helix, at the time of writing, is 0.1.10. This causes commands like lein search to display outdated versions of packages.

I'll note that the API endpoint returns the latest version. Consider https://clojars.org/api/artifacts/lilactown/helix . This returns an EDN map with [:latest_version "0.1.10"] as a key-value pair.

tobias commented 1 year ago

Hi @rome-user! Thanks for reporting this. I suspect it is caused by the query that pulls all the jars/versions for indexing isn't ordered, so 0.0.12 may appear in the resultset after 0.1.10. This would cause thhe index doc for 0.0.12 to overwrite the doc for 0.1.10 on a full reindex. I'll take a look at fixing this this week.

tobias commented 1 year ago

@rome-user This should be fixed now!