Modify

Opened 5 years ago

Last modified 4 months ago

#6395 assigned enhancement

Option to display tag cloud in descending order

Reported by: lizadri Owned by: hasienda
Priority: normal Component: TagsPlugin
Severity: normal Keywords: list sorted
Cc: Trac Release: 0.11

Description

How can I modify tractags.macros to display tag cloud in descending order, starting with the most used tags?
I don't understantand what is the current sort order.

Attachments (1)

TagCloud.png (86.9 KB) - added by rjollos 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by rjollos

  • Summary changed from display tag cloud in descending order to Option to display tag cloud in descending order

It is strange, because on my Trac (running TagsPlugin 0.6) they are mostly displayed alphabetically, with the exception of the entries at the end,


Last edited 4 months ago by rjollos (previous) (diff)

Changed 5 years ago by rjollos

comment:2 Changed 5 years ago by lizadri

I don't mean alphabetical order. I would like to see the most used tags at the beginning of the cloud (tags ordered by their occurrence).

comment:3 in reply to: ↑ description Changed 5 years ago by rjollos

You had asked:

Replying to lizadri:

I don't understantand what is the current sort order.

I was just trying to determine what is the current sort order. Given that, maybe we can add an option to the macro ... however, the current sort order doesn't make much sense to me.

comment:4 follow-up: Changed 5 years ago by lizadri

I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-)
The first step of implementation should be suggest the most used tags (eg. top ten).

comment:5 Changed 21 months ago by hasienda

  • Keywords list sorted added

I see your point.

There is an internal object, that could be used for sorting on number of occurrences. However, please understand, that right now performance (#4503) is a much higher priority than new features, so this is still getting postponed.

comment:6 Changed 6 months ago by hasienda

Implementation of this feature request will be easier now with new Counter objects, still it should be considered for next release's development.

comment:7 in reply to: ↑ 4 Changed 5 months ago by hasienda

  • Owner changed from athomas to hasienda
  • Status changed from new to assigned

Replying to lizadri:

I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-)
The first step of implementation should be suggest the most used tags (eg. top ten).

Since [13427] we have tractags.api.TagSystem.get_all_tags(), so it is part of current stable tractags-0.7 as well.

This method returns a Counter object. Use its .most_common(n) method to extract the <n> top-most tags as a list of tuples with their number of occurrence in descending order. This will likely give you all you need for your plugin application.

I'm undecided how to proceed here. The request regarding API usage for other Trac plugins is clearly resolved IMHO.

Do we need more options regarding the sorting order? For the macro and web-UI. Maybe, but if any, I suggest extending cloud_caseless_sort into something more general, like a cloud_sort list option, and make desc another list entry next to caseless. Thoughts?

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.