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

Tag ordering backend #336

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

samuellieberman
Copy link
Contributor

This is intended to provide more and more complicated tag sorting options than #329, as well as bringing tag sorting functionality into its own file to be used in multiple places. Currently the code works and sorts all results in the add tag panels, but the code itself is a work in progress. See commit b9316fa for a little of the work I have planned.

The most notable tag sorting option is sorting tags based on an automatically generated lineage, a chain of parent tags present in the search. This feature is set up so that parent tags and their children and grandchildren will all appear next to each-other in the list of tags, in a tree-like fashion. It is set up to automatically respect any sort properties that come before or after it. Here is an example with ascending lineage depth:
image

To mess around with the sort order, modify _default_sort.

# _default_sort must contain LINEAGE_DEPTH and ID
_default_sort: Sort = [
(TagSortProperty.LINEAGE_DEPTH, TagSortDirection.DESC),
(TagSortProperty.DESCENDENT_COUNT, TagSortDirection.DESC),
(TagSortProperty.NAME, TagSortDirection.ASC),
(TagSortProperty.COLOR, TagSortDirection.ASC),
(TagSortProperty.ID, TagSortDirection.ASC),
]

Try changing the order of the properties and swapping between TagSortDirection.ASC and TagSortDirection.DESC

Currently these are the only tag properties that are supported. In the future, I plan to add other options, such as sorting tags based on how many times they appear in the library's entries. I am taking suggestions for other tag properties to calculate and sort by.

Adds functionality to "group" tags based on an automatically generated "lineage" from a root grandparent tag to most given grandchild tags.

Needs major improvements:
* Better naming of variables.
* Better encapsulation of sort information
* Support for circular lineages
* Comments
* More?
@CyanVoxel CyanVoxel added TagStudio: Tags Relating to the TagStudio tag system Status: Review Needed A review of this is needed labels Aug 22, 2024
@eivl
Copy link
Collaborator

eivl commented Sep 6, 2024

Any news on this work @samuellieberman ? i would love to do a review once you are ready and all tests are passing.

@CyanVoxel CyanVoxel removed the Status: Review Needed A review of this is needed label Sep 6, 2024
@CyanVoxel
Copy link
Member

Any news on this work samuellieberman ? i would love to do a review once you are ready and all tests are passing.

This one will likely need to get reworked once #332 is merged

@seakrueger
Copy link
Collaborator

Just wanted to bump this and check if this is still being worked on. Unfortunately, since the SQL migration, this might require a significant rework. I think this could a useful feature especially with newer, similar requests (I.e; #542). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TagStudio: Tags Relating to the TagStudio tag system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants