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-generated summary
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/pluginlolz
になるかもしれません
私の最初の考えは、DBに中間テーブルを作成することでした。Lolz、とても低レベル ![]()
おそらく、より良い解決策は次のようになります。
- モデルクラスの参照または関連を追加する
- DBでカテゴリに関連付けられたトピックのリストをインデックス化し、
@category.all_published_topicsなどを呼び出すときにそれらのトピックをバンドルするメソッドを呼び出す
それで、これ以上深く掘り下げる前に、この問題に関して厳格な技術的な禁止事項があるかどうかを知りたかっただけです ![]()
それは特定するのが簡単です。ソースコードを見てください。設計の基本です。
これは主要な機能の柱です。
この単一の整数属性は、モデルコード、API、バックエンドプロセス、UI全体に存在します。テーマコンポーネントやプラグインの数十個すべてに1つしかないという仮定もあると思います。
そのようなコア設計/仮定を変更しようとするのは非常に勇気がいるでしょう。それは多くの作業であり、エコシステムで利用可能な多くの拡張機能を使用できなくなる可能性があります。
インスタンスのアップグレードも非常に困難で経済的に不可能になるでしょう。
カテゴリの代わりにタグを使用することを提案してもよろしいでしょうか?
トピックには多くのタグを付けることができ、多くのタグリストに表示することもできます。