Dale
Dale

Reputation: 141

Combining new ArangoSearch views and graph traversals

I've read through the ArangoDB 3.4 docs and the ArangoSearch view tutorial, but I'm still unclear on if/how views can be combined with graph traversals. There is an example of a graph/view join in the tutorial; however, what I need to do is to simply filter the candidate pool resulting from a traversal with a view-based text search. For example:

"for i in 2..2 outbound start_doc edges1, inbound edges2 [filter by view] return i"

The initial 2-hop traversal from the "start_doc" vertex will result in a much smaller candidate pool than the entire collection. I want to then perform a text search on this candidate pool using a configured view (probably "text_en" analyzer).

Would i just define the view expression after the traversal? Or would I need to use a "union_distinct" function to combine the traversal and the search results? (This seem like it would be very inefficient given a potentially very large result set from the view.)

Thanks!

Upvotes: 3

Views: 456

Answers (1)

This is how I solved a similar problem, perhaps it will work for you too:

for i in 2..2 outbound start_doc edges1, inbound edges2
filter (
    for x in view
        search i._key == x._key and search_condition
        limit 1
        return x
) != []
return i

Upvotes: 3

Related Questions