Search code examples
traversalarangodb

Arangodb- Differences between filter and expandFilter in Foxx traversal


In traversal config options, there is two settings that seemed to do the same thing that is filter and expandFilter. is there any differences between them?


Solution

  • While filter is used to limit returned result of vertices using a traversal, expandFilter can exclude certain edges from the traversal.

    • filter: vertex filter function. The function signature is function (config, vertex, path). It may return one of the following values:
      • undefined: vertex will be included in the result and connected edges will be traversed
      • "exclude": vertex will not be included in the result and connected edges will be traversed
      • "prune": vertex will be included in the result but connected edges will not be traversed
      • [ "prune", "exclude" ]: vertex will not be included in the result and connected edges will not be returned
    • expandFilter: filter function applied on each edge/vertex combination determined by the expander. The function signature is function (config, vertex, edge, path). The function should return true if the edge/vertex combination should be processed, and false if it should be ignored.

    This is documented in the ArangoDB Manual.