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

[Feature] Sort_Name for Tags #3108

Open
stg-annon opened this issue Nov 9, 2022 · 1 comment
Open

[Feature] Sort_Name for Tags #3108

stg-annon opened this issue Nov 9, 2022 · 1 comment

Comments

@stg-annon
Copy link
Collaborator

stg-annon commented Nov 9, 2022

This issue is for Tags specifically, but this concept could be applied to other types of objects as well.

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

sorting tags by name there is often an order that would be preferable but does not work with a standard alphanumeric sort without altering the name of the tag

Describe the solution you'd like

the addition of a sort_name attribute to Tags that when present would be used over name when sorting tags

example:

SELECT COALESCE(sort_name, name) as sname ORDER BY sname

Describe alternatives you've considered

I often add a prefix that changes the sort order of the tags, while useful this makes the tag ugly where it is displayed in the UI this also changes the main name for the tag which can make scraping difficult

Implementation

Ideally the sort_name would also be available in the DOM so that userscripts might take advantage of it. Perhaps as an addental attribute in the <a> element like <a href="link" data-tag-sort-name="sort_name">Tag Name<a>

Additional context

As has been mentioned elsewhere this could also be used as an ad-hoc way of a user adding namespaces (#1253) to tags.

For example:
a sort name for a Performer tag could be Performer - Tall and with relatively minimal effort, tags being added in a performer context could be filtered by {"sort_name": {"modifier":"MATCHES_REGEX", "value": "^Performer"}}, which could be defined in a config by the user to filter tags in such a context, allowing for namespaces in a way which preserves most of the current functionality of tags

@AdultSun
Copy link
Contributor

AdultSun commented Nov 9, 2022

To add onto the "alternatives" section, adding a prefix to the name also breaks tag matching in draft submissions to a Stash-Box. It expects the name in Stash to match either the primary name, an alias, or a previously merged name in the Stash-Box. The other solution to this problem is to add StashIDs to tags for matching instead, same as studios and performers.

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

2 participants