feat: add sorting by file size#1330
Open
baracchande wants to merge 1 commit intoTagStudioDev:mainfrom
Open
Conversation
Computerdores
suggested changes
Mar 6, 2026
Comment on lines
+1092
to
+1094
| if is_size_sort: | ||
| ids = self._sort_ids_by_file_size(ids, search.ascending) | ||
|
|
Collaborator
There was a problem hiding this comment.
This breaks when the query has a LIMIT due to the page size.
Collaborator
|
Also, unless you speak 19 languages those are AI/machine translations and I would prefer not having those in here. Because while I'm not sure whether we have an official policy on AI/machine translations, I would personally prefer a high quality of translations over a high quantity (and people are less likely to contribute when translations are suboptimal rather than missing), so I would prefer a missing translation over an AI one (also should we redecide in the future we can do the AI translations ourselves, where as we won't have any idea how good our translations are if we allow AI translations). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
core/library/alchemy/enums.py: AddedSIZE = "file.size"toSortingModeEnumcore/library/alchemy/library.pysearch_library(): when SIZE mode is active, skips SQL ordering (falls back to Entry.id) and calls_sort_ids_by_file_size()after the query returns._sort_ids_by_file_size(): bulk-fetches all entry paths in one query, calls stat().st_size on each file, returns the IDs sorted by size. Missing/unlinked files get size -1 and sort to the front (ascending).Added "file.size" key with a proper translation in each translation file.
tests/test_search.py: Four new tests.This implements the file size sort option requested in 207
Tasks Completed