Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting options when searching for map or mod #2680

Closed
Garanas opened this issue Apr 28, 2022 · 12 comments
Closed

Sorting options when searching for map or mod #2680

Garanas opened this issue Apr 28, 2022 · 12 comments

Comments

@Garanas
Copy link
Member

Garanas commented Apr 28, 2022

Is your feature request related to a problem? Please describe.

When searching in the vault you can only sort on name. This is unintuitive when searching for adaptive or survival maps as you are likely more interested in good adaptive / survival maps over those that happen to start with the letter a.

image

Describe the solution you'd like

You should be able to sort on:

  • most recent maps / mods
  • most valued maps / mods (using star system)
  • most played maps / mods

And either of these should be the default, I'd argue it should be most valued as that keeps the most relevant maps on top and allows for shifts in the hierarchy that make sense. As an example, if you use most player then it may take years (if not more) for a map or mod to get onto the first page. But when using the most valued criteria it can be achieved within weeks.

Describe alternatives you've considered

I don't feel there is an alternative.

@Sheikah45
Copy link
Member

This is actually a limitation of the underlying api that the vault uses that has been under work to improve here FAForever/faf-java-api#448

@Sheikah45
Copy link
Member

Although I can look at which ones don't have the underlying limitation

@Sheikah45
Copy link
Member

Ah yeah never mind can't sort over it because it doesn't support pagination

@Eternal-ll
Copy link

Eternal-ll commented Apr 29, 2022

API works like a charm https://youtu.be/gnbehQYP-58

It is just sample, but with additional work it is possible to add multiple sorts i guess

image

image

@Sheikah45
Copy link
Member

Eternal that only works for direct attributes of the objects, sorting will return an error if you try to sort over related object attributes

@bukajsytlos
Copy link
Member

bukajsytlos commented Jun 17, 2022 via email

@Eternal-ll
Copy link

https://api.faforever.com/data/mapVersion?include=map&sort=-map.gamesPlayed over map attributes from mapVersion

@bukajsytlos
Copy link
Member

bukajsytlos commented Jun 18, 2022

to be more more precise :)

//SQL does not support distinct and order by on columns which are not selected
                throw new InvalidValueException("Combination of pagination, sorting over relationship and"
                    + " filtering over toMany relationships unsupported");

Elide would in this conditions create query, which would sort over not selected fields.
More https://blog.jooq.org/how-sql-distinct-and-order-by-are-related/

@Sheikah45
Copy link
Member

Does this mean we just have to include anything we sort?

@bukajsytlos
Copy link
Member

https://api.faforever.com/data/mapVersion?include=map&sort=-map.gamesPlayed over map attributes from mapVersion

btw that's many to one

@bukajsytlos
Copy link
Member

Does this mean we just have to include anything we sort?

theoretically, but it is not possible with one to many relationships. it would break pagination because of duplicates

@Sheikah45
Copy link
Member

sounds good. For now I will close this though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants