In many cases, it’s very useful and rigorous to set a topic under many categories. Is it possible to do so with Discourse?
AI 生成的摘要
The discussion revolves around the possibility of assigning a topic to multiple categories in Discourse. mausconi inquires about this feature, and lisajill responds that it’s not possible, suggesting the use of the tagging system instead. Mittineague proposes pinning globally as a potential solution, but lisajill dismisses this idea.
rudzainy shares a use case where assigning a topic to multiple categories would be beneficial and explores possible technical solutions, such as creating a middle table in the database or adding a model class reference. However, merefield points out that the current design of Discourse relies heavily on a single category per topic and that changing this would require significant work and potentially break compatibility with extensions and upgrades. As an alternative, merefield suggests using tags, which can be assigned to multiple topics and appear in multiple tag lists.
No. You’d need to use the tagging system for something equivalent and that would have no hierarchy.
Would Pinning Globally work?
你好 ![]()
我想知道这有什么技术限制。
我的一个用例是:
- 一个标题为 “地点 A 的当地美食通常比地点 B 的当地美食更咸” 的主题
- 其中 地点 A 和 地点 B 是类别名称
- 有一个投票,选项为
同意、中立和不同意 - 能够将主题保存在两个类别下,可以从第一天开始同步两个类别之间的对话和投票(或者希望在主题创建后的几天内),而不是在问题病毒式传播后才被动地合并重复的主题)
- 这个功能的一个很酷的代号可以是
anti-cross-categories-topic-duplication-feature/plugin哈哈
我的第一个想法是在数据库中创建一个中间表。哈哈,太底层了 ![]()
也许有一些更好的解决方案:
- 添加一个模型类引用或关联
- 在数据库中索引与类别关联的主题列表,并在调用
@category.all_published_topics或类似方法时调用一个方法来捆绑这些主题
所以,我想知道在深入研究之前,关于这个问题是否有严格的技术禁忌 ![]()
嗯,这很容易识别,看看源代码,它对设计来说非常基础:
这是一个主要的职能支柱。
这个单一的整数属性遍布模型代码、API、后端进程和 UI。我猜想,在数十个主题组件和插件中,也假设只有一个。
你要非常勇敢才能尝试改变如此核心的设计/假设,而且这将是大量的工作,你可能无法使用生态系统中提供的许多扩展。
你几乎肯定会发现升级实例也是非常困难/经济上不可能的。
我能建议你使用标签而不是分类吗?
一个主题可以有多个标签,因此可以出现在多个标签列表中。