私には2つのエンティティがあります。たとえばエンティティ[x]と[y]です。両方のエンティティがいくつかのタグに関連付けられています。エンティティ[y]は、類似した[x]エンティティを検索するために使用されます。例:エンティティ[y]がタグ「books」と「blogs」で構成されている場合、これらのタグの両方を持つすべての[x]エンティティのリストが必要です。
私のテーブルスキーマは次のとおりです。
[x]
entity_id int // its a foreign key from entity table
tag varchar // this is the tag to be matched
(one entity can have multiple tags hence multiple rows of same entity
id will be inserted)
[y]
entity_id int // again a foreign key from entity2 table
tag varchar // tags again
(same comment comes here too)
もう1つの例として、[y] entity_id 10があり、この10のentity_idが「bus」、「train」、「plane」の3つのタグに関連付けられているとします。このentity_id 10を使用して検索する場合は、これら3つのタグすべてに関連付けられている[x]entity_idsのリスト。[x]entity_idには追加のタグを付けることもできます。