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

3

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.

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

-- 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
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  -- no wiki/excerpt
           AND (@max_excerpt_len <> -1 OR @max_body_len <> -1))
       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