标记系统设计问题
我正在一个新闻网站上工作,我正在考虑实现一个标记系统(类似于此网站),您可以根据不同的类别类型对新闻进行分类,例如:新闻类别(经济、政治等),但是还有诸如编写语言和新闻文章类型(社论、专题报道等)之类的信息。
我应该如何区分这些不同的类别类型?我应该为每种类别类型提供一张标签表,还是应该将所有内容保留在一张表中并具有标签前缀,例如“语言:en”、“类别:经济”?第二种解决方案似乎更灵活,因为我只需添加前缀即可添加更多护理类型。然而,第一个解决方案感觉更加结构化并且更易于使用。
另外,我想知道您如何确定何时应将某些内容表示为标签或何时应将其表示为数据库中的列值/记录(例如,该语言应该是标签还是我的“新闻”表中是否有语言列?) 。我不知道该在哪里划清界限。
谢谢
I'm working on a news site and I'm thinking of implementing a tagging system (similar to this site) where you'll be able to categorize news by different category types such as: newscategory (economy, politics, etc.) but also things such as language it was written in and type of news article (editorial, feature story, etc.).
How should I distinguish between these different category types? Should I have one table of tags for each category type, or should I keep everything in one table and have a tag-prefix such as "language:en", "category:economy"? The second solution seems more flexible because I can add more caregory types just by appending a prefix. However the first solution feels more structured and easier to work with.
Also, I wonder how you determine when something should be represented as a tag or when it should be a column value/record in the database (e.g. should the language be a tag or do I have language column in my "News" table?). I'm not sure where to draw the line.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
说标签本身可以按层次结构排序就足够了吗?如果是这样,只需将
parent_tag_id
添加到您的tags
表中即可。您可能将列视为静态字段,将行视为动态字段。保持较低的列数。语言可能是表中所有字段都应与一种语言相关联的列。
Would it be sufficient to say that the tags themselves could be ordered in a hierarchy? If so, just add a
parent_tag_id
to yourtags
table.You might think of columns as static fields and rows as dynamic. Keep the number of columns low. Language might be a column of all fields in the table should be associated with a language.