0

My database is currently storing information related to user searches. For example we have a User and Term vertex. User has a property called employeeId while Term has a property called "q" which will contain the search query. We draw an edge called 'searched' between them. What I would like to be able to do is suggest other searches to the user which might be related. I have a query which I feel sort of does the trick by doing a traverse from a term and ordering by depth and count. I'm sure there might be better way out there to do the query, or find better results.

User --searched--> Term

In this snippet below I would send in a term that got searched for, and use that in a like search to find terms which also contain that word.

@orient_query = "SELECT $depth, q, in().size() AS count FROM (TRAVERSE * FROM (select from Term where q.toLowerCase() LIKE 'aluminum') STRATEGY BREADTH_FIRST) WHERE @class = 'Term' AND $depth <> 0 ORDER BY $depth ASC, count DESC"

I guess my main concern is that there is a much better way out there to do this and find better results. My original thought process was that we needed a combination of depth in the traversal vs counts of how many times that search came up.

Edit: What I'm also seeing that other searches which contain the word "aluminum" like "aluminum alloy" are showing up really far down the results since their depth is higher.

DB at PS
  • 111
  • 11

0 Answers0