Sort By Most Popular Tags
-
muzicman82
- Posts: 19
- Joined: 19 Dec 2019 20:48
Sort By Most Popular Tags
In my next adventure, I am looking for how I can set up a view that sorts by the most popular tags? The top of the list would have all files with the tag that appears on the most files, and the last files in the list would have tags that may be attached to only one file. I suppose trouble comes with a file has multiple tags. I would just say that the most popular tag takes over the sort.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sort By Most Popular Tags
Get all tags from all files in the current folder
Build a lookup table that stores the number of occurrences for each single tag + the tag itself (one combination for each tag)
Loop over all files, build a final list that contains the file, the highest count from the lookup table for its tags (choose the largest number of all tags it has, here)
Loop over the final list, populate extra columns with the result (highest count + belonging tag) and sort by it
Build a lookup table that stores the number of occurrences for each single tag + the tag itself (one combination for each tag)
Loop over all files, build a final list that contains the file, the highest count from the lookup table for its tags (choose the largest number of all tags it has, here)
Loop over the final list, populate extra columns with the result (highest count + belonging tag) and sort by it
One of my scripts helped you out? Please donate via Paypal
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sort By Most Popular Tags
Looks doable...
A few foreach loops would be necessary but it shouldn't require more than ~40 lines
Extra 1 = The count so that the list can be sorted
Extra 2 = The tag that was found most often and led to that count value
A few foreach loops would be necessary but it shouldn't require more than ~40 lines
Extra 1 = The count so that the list can be sorted
Extra 2 = The tag that was found most often and led to that count value
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club