Simple "more like this" feature


I have objects (Item) and each item has 0+ tags.

I’m trying to implement “more like this” behaviour, when based on the given item I can find items with most common tags with my item.

<item_tag>: string @index(term) @upsert .
<tags>: uid @count @reverse .
<unique_id>: string @index(term) @upsert .
  set {
    _:item1 <unique_id> "Item1" .
    _:item2 <unique_id> "Item2" .
    _:item3 <unique_id> "Item3" .
    _:tag1 <item_tag> "Tag1" .
    _:tag2 <item_tag> "Tag2" .
    _:tag3 <item_tag> "Tag3" .

    _:item1 <tags> _:tag1 .
    _:item1 <tags> _:tag2 .
    _:item1 <tags> _:tag3 .

    _:item2 <tags> _:tag1 .
    _:item2 <tags> _:tag2 .
    _:item3 <tags> _:tag2 .
    _:item3 <tags> _:tag3 .


Any suggestions? Or maybe there is already ready example.


What suggestions do you need?

I have a similar example that you can try out