Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of all tags used in stackoverflow

I am building a website, which categorizes IT problems.

How can I get the content of all tags used on stackoverflow?

I need to use the same tagging feature with the same content, but separately.

How to extract the content of all tags? (should be a couple of thousand)

like image 270
Jack Russel Avatar asked Oct 25 '15 21:10

Jack Russel


2 Answers

You can utilize the Stack Exchange Data Explorer for gathering this type of information.

The query below will pull all tags, their excerpts and their wiki content:

select 
  t.tagName,
  e.body as 'Excerpt',
  w.body as 'WikiBody'
from tags t
left join Posts e
  on t.ExcerptPostId = e.Id
left join Posts w
  on t.WikiPostId = w.Id
order by t.tagName

At the time of this post, this returns 42,553 rows.

Note that not all tags have excerpts or wiki content.

like image 134
Andy Avatar answered Sep 20 '22 16:09

Andy


I developed upon @andy answer and gathered up each tag's synonyms as well

select e.id,
  count(t.tagName),
  string_agg(TagSynonyms.SourceTagName, ',') as synonyms,
  t.tagName,
  e.body as 'Excerpt',
  w.body as 'WikiBody'
from tags t
left join Posts e
  on t.ExcerptPostId = e.Id
left join Posts w
  on t.WikiPostId = w.Id
left join TagSynonyms 
  on TagSynonyms.TargetTagName = t.tagName
group by t.tagName, e.body, w.body, e.id
order by  count(t.tagName) desc

link is here

like image 44
Amir Heshmati Avatar answered Sep 21 '22 16:09

Amir Heshmati