Number of matches

Hi there!

I wonder if anyone can help out. We are using DGraph to do some keyword matching - where there are a number of ‘things’ and each ‘thing’ is linked to many keyword nodes with a ‘has_keyword’ edge.

We send a long list of input search terms and try to match any ‘thing’ that has a matching keyword.

Now, keywords in our case don’t have to be single words, they could be phrases eg ‘change email address’ or ‘email hacked’.

We would like to be able to tell the strength of the match to the initial input term, where strength is measured by how many keywords were matched.

Eg, if the input search was “email hacked account”, ‘change email address’ would match with a strength of 1 and ‘email hacked’ would have strength 2.

Wondering how best to go about this purely through a DGraph query.

Does anyone have any ideas here?