Possibilità di eliminare tag con meno di N argomenti

Ho appena scoperto questa fantastica funzionalità, “elimina tag non utilizzati”, e mi ha lasciato desiderare di più!

Proseguendo la discussione da Una guida completa ai tag di Discourse:

Abbiamo molti tag con “count: 1”, poiché la creazione dei tag non è affatto bloccata e alcune persone li trattano semplicemente come hashtag. Credo ancora nel mantenere aperte le autorizzazioni per i tag, ma sarebbe bello poter potare il giardino più facilmente e periodicamente.

Mi piacerebbe trovare modi per spingere le persone a considerare i tag come un mezzo per “raggruppare” argomenti correlati e a creare tag solo quando pensano (o sanno!) che verranno utilizzati più di una volta.

Nel frattempo, però, credo che estendere la funzionalità esistente per consentire l’“eliminazione dei tag utilizzati da meno di __ argomenti” potrebbe essere un ottimo miglioramento che useremmo.

4 Mi Piace

Even fancier, I could imagine a setting that would automatically sweep tags and delete tags based on the following criteria:

count < N && topic_last_updated > X months ago

Basically, you let tags have a chance to get a toe hold. Their life is renewed if new topics are posted before some timeout. But if no new topics have been posted for more than, say 3 months, and the tag has less than 5 topics, then just get rid of it.

6 Mi Piace

I also think these are good suggestions for improving the tag cleanup function @neil

2 Mi Piace

I’ve never seen this button either, and I agree that an auto-cleanup feature would be useful. It should also be careful about not deleting tags that are staff-only. There are probably other cases where some tags shouldn’t be deleted automatically.

2 Mi Piace

In the meantime, here’s a #plugin:data-explorer query that can help folks identify candidate tags for deletion:

-- [params]
-- int :months_since_used = 24
-- int :max_topic_count = 50

with
t as (
  select 
    current_date::timestamp - (:months_since_used * (INTERVAL '1 months')) as cutoff_date
),
topic_tag_dates as (
  select tags.id, tags.name, tags.topic_count, topics.last_posted_at as last_used
  from topic_tags
  left join tags
  on topic_tags.tag_id = tags.id
  left join topics
  on topic_tags.topic_id = topics.id
),
max_last_used as(
  select id, max(last_used) mx from topic_tag_dates
  group by id
),
tag_last_used as (
  select topic_tag_dates.id, name, topic_count, last_used from topic_tag_dates
  left join max_last_used
  on topic_tag_dates.id = max_last_used.id
  where max_last_used.mx = topic_tag_dates.last_used
)
select id,name,topic_count,last_used from tag_last_used, t
  where tag_last_used.last_used < t.cutoff_date
  and topic_count < :max_topic_count
  order by topic_count desc
5 Mi Piace

I apologise for the bump,

Yes - this is heavily needed as some people on my forum decided it would be funny to joke around and post let’s say ‘interesting’ tags not appropriate for all ages therefore I’d like to see this sort of feature.

Thanks.

1 Mi Piace

Quindi come eseguirlo per eliminare se topics = 1?

Perché il pulitore predefinito elimina solo i tag senza argomenti. Stiamo formando il nostro personale e ho limitato la creazione di nuovi.