wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
846 stars 786 forks source link

API pagination inconsistency in Developer Portal #4869

Closed tgtshanika closed 2 years ago

tgtshanika commented 5 years ago

Description

When showing APIs in Developer Portal, we are only showing the latest version when there are multiple API versions. But the APIs are not properly aligned into pages. The reason is that the filtering for latest version and pagination is done from the code level after retrieving APIs with versions from the DB (registry).

Solutions

APIs needs to be filtered properly (with the latest version) from the persistence level (Registry) itself.

There are a few ways we can check:

isharac commented 3 years ago

This can be achieved with a solr query group=true&group.field=name&group.ngroups=true&group.sort=version desc

However, with the default sorting, if we have API version as 1.0.0. 2.0.0 10.0.0 the latest version is selected as 2.0.0 instead of 10.0.0 because version is considered as a string

isharac commented 3 years ago

To fix the above issue it has introduced a new field in solr which sets a timestamp to each API version created. Based on that latest API version is fetched to display in the devportal when displayMultipleVersions config is not enabled.