bitmagnet icon indicating copy to clipboard operation
bitmagnet copied to clipboard

Ordering of search results in GraphQL API and UI

Open mgdigital opened this issue 2 years ago • 2 comments

Gathering this in a single issue although I don't expect it will be implemented in a single PR.

A good starter would be:

  • size
  • torrent created at
  • name
  • seeders, leechers (a bit more complicated needs to get a max from torrents_torrent_sources table)

Will need familiarity with the existing search implementation; currently the domain-specific search code lives here: https://github.com/bitmagnet-io/bitmagnet/tree/main/internal/database/search

So I imagine these files would be called things like:

  • internal/database/search/order_torrent_created_at.go etc...

There are a couple of simple examples of ordering here: https://github.com/bitmagnet-io/bitmagnet/blob/main/internal/database/query/options.go#L117

I'd envisage a search parameter with enums that could be passed as an array, e.g. order: [size_desc, created_desc, name_asc].

For the UI a simple dropdown next to the search input would probably suffice for now, with links on the relevant table headers.

mgdigital avatar Oct 05 '23 21:10 mgdigital

Seconding this, as far as the UI, links on the relevant table headers would be excellent. ie if I click "Size", it should show all the largest results first, if I click again, it should show all the smallest, etc.

aidan-gibson avatar Mar 04 '24 07:03 aidan-gibson

I really have to add my support for this. I have 433,000+ results, and most of them are 0 or 1 seeders, and I can't even begin to meaningfully explore these for interesting files without being able to either sort or filter based on things like seeders or size.

eavalenzuela avatar Apr 29 '24 23:04 eavalenzuela

Ordering capability has been added in https://github.com/bitmagnet-io/bitmagnet/pull/260

mgdigital avatar May 18 '24 09:05 mgdigital