JanitorTags: Most common tags with short, long, or missing excerpt or wiki

1

Please login or register to vote for this query.

(click on this box to dismiss)

Lists the most commonly used tags with empty/missing/short tag wikis (wiki or excerpt). Can also identify tag wikis that are over a specified length. Enter -1 for all parameters to match all tags. Tags that have been synonymized are excluded.

Amateur Radio

Q&A for amateur radio enthusiasts

-- MaxBodyLength: Body shorter than "Set to -1 to disable"
DECLARE @max_body_len int = ##MaxBodyLength:int?-1##;
-- MaxExcerptLength: or excerpt shorter than "Set to -1 to disable"
DECLARE @max_excerpt_len int = ##MaxExcerptLength:int?1##;
-- MinBodyLength: or body longer than "Set to -1 to disable"
DECLARE @min_body_len int = ##MinBodyLength:int?12000##;
-- MinExcerptLength: or excerpt longer than "Set to -1 to disable"
DECLARE @min_excerpt_len int = ##MinExcerptLength:int?-1##;

SELECT t.Count,
       t.TagName,
       coalesce(len(pe.Body),0) as [Excerpt length],
       coalesce(len(pw.Body),0) as [Wiki length],
--       t.ExcerptPostId as [Post Link],
       pe.CreationDate,
       tssrc.TargetTagName as [Deleted synonym target]
FROM   Tags t
       LEFT JOIN Posts pe on pe.Id = t.ExcerptPostId
       LEFT JOIN Posts pw on pw.Id = t.WikiPostId
       LEFT JOIN TagSynonyms tssrc on tssrc.SourceTagName = t.TagName
       LEFT JOIN Tags tgt on tssrc.TargetTagName = tgt.TagName
WHERE  -- match everything if all parameters are -1
       ((@max_body_len = -1 and @max_excerpt_len = -1
        and @min_body_len = -1 and @min_excerpt_len = -1)
       or (t.WikiPostId is null and @max_body_len <> -1) -- no wiki
       or (t.ExcerptPostId is null and @max_excerpt_len <> -1) -- no excerpt
       or len(pe.Body) < nullif(@max_excerpt_len,-1) -- short excerpt
       or len(pw.Body) < nullif(@max_body_len,-1)    -- short wiki
       or len(pe.Body) > nullif(@min_excerpt_len,-1) -- long excerpt
       or len(pw.Body) > nullif(@min_body_len,-1))   -- long wiki
       and (tssrc.SourceTagName is null -- exclude tags that are synonyms
            or tgt.TagName is null)     -- unless the synonym target is gone
ORDER  BY Count desc,
       coalesce(len(pe.Body),0) asc,
       coalesce(len(pw.body),0) asc,
       t.TagName

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results