indexer icon indicating copy to clipboard operation
indexer copied to clipboard

Allow sorting of responses

Open chicopaec opened this issue 3 years ago • 12 comments

It would be very helpful if some of the responses could be sorted by arbitrary fields. For example, to have the /transactions endpoint return the latest transactions by the block number, in descending order, so you can get the latest transactions without having to do any pagination.

chicopaec avatar Mar 16 '21 09:03 chicopaec

When filtering by account address results are returned newest to oldest, otherwise, they are returned oldest to newest.

For reference, I implemented this in a prototype while debugging something and we had some discussion: https://github.com/algorand/indexer/pull/283/files#diff-8fbec00be6e6b2f77a294cbe9a3ee8e3fbdcb5eb13be3046e5da8277302264c2L1400

Needs clarification

  1. Should we support arbitrary fields, start with a specific field, or select some specific fields.

Acceptance Criteria

  1. Update the ORDER BY part of the SQL query.
  2. Update the pagination rules so that they take the new order configuration into account.
  3. Disable this new field by default, because it would require custom indices to be fast.

This should be converted to an epic. In addition to the acceptance criteria above, we would need to add sorting to all the different types of searches:

  • transaction
  • account
  • asset / asset holding
  • application / application state / boxes

winder avatar Mar 16 '21 13:03 winder

+1 this feature - in particular I would like to get the oldest transaction for a given account and application. Since I use the account field, the responses are automatically ordered from most recent to oldest and the limit parameter doesn't work as needed.

gidonkatten avatar Dec 16 '21 22:12 gidonkatten

+1 to this, we've also faced a need to get transactions ordered by desc

ncherkas avatar Apr 11 '22 10:04 ncherkas

+1 to this feature. It would be really helpful if we have sorted by field or at least the latest transactions.

algodesk-io avatar Apr 19 '22 05:04 algodesk-io

@chaihoang we need to clarify what we should support for this issue.

winder avatar Sep 22 '22 16:09 winder

Hi Team,

Do you have any plans to fix this issue ?

This is a critical requirement for my application (Explorer). https://app.dappflow.org

Screenshot 2022-09-27 at 8 03 46 PM

Attached is the screenshot of the asset overview page. Older transactions pop up first and the user has to navigate back to the last page to look at the recent transactions of the asset.

This is a must-have if we want to build the indexer UI.

algodesk-io avatar Sep 27 '22 14:09 algodesk-io

@algodesk-io It's not on the roadmap yet, but we are considering it. What are the use cases that would be most beneficial? Is it just sorting by newest transactions?

chaihoang avatar Oct 03 '22 13:10 chaihoang

@algodesk-io It's not on the roadmap yet, but we are considering it. What are the use cases that would be most beneficial? Is it just sorting by newest transactions?

Yes, sorting by newest transactions for an asset, application, account, should solve 50% of the usecase.

remaining includes, Sort by newest assets Sort by newest applications

algodesk-io avatar Oct 03 '22 13:10 algodesk-io