How to design a MySql Table for a Tag Cloud?

前端 未结 3 1735
有刺的猬
有刺的猬 2021-02-03 13:13

I have articles on my site, and I would like to add tags which would describe each article, but I\'m having problems with design mysql table for tags. I have two ideas:

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-03 13:45

    yes, but you didn't answer my main question, how to get 3 most similar articles?

    Answer: Just look for the same tag ids in the merged table (tags_articles). Gather them and create a pattern.

    For example: Article 1 has tags: 1,2 Article 2 has tags: 2,3,4 Article 5 has tags: 6,7,2 Article 7 has tags: 7,1,2,3

    If you want the 3 most similar articles for article 1, you have to look for the tags 1,2. You'll find Article 7 is most similar and 2 and 5 have some similarities.

提交回复
热议问题