Search code examples
neo4jcypherneo4j-apoc

Can I call 2 apoc procedures and combine the result sets in cypher?


I would like to call 2 different procedures and combine the output for further matches in one cypher query. Is it possible?

So, to make it more clear:

  • I have created a manual index which I use in my queries with call apoc.index.search("myindex","searchterm")
  • I also have some own procedure, which I would like to use together with the apoc.index.search from above.

So I would with something like that

call 
apoc.index.search("myindex","searchterm") and my.own.procedure("searchterm") 
yield both resultsets

Are there any ways to do this?


Solution

  • Thank you @cybersam for your comment. I've found out how to use two procedure calls. In my case it was:

    ```
    CALL my.own.procedure(params) YIELD node as molecule, score as score 
    CALL apoc.index.search('search-index',{keyword}) YIELD node as finding 
        MATCH (molecule)<-[:CONTAINS]-(d:Document) 
        MATCH (finding)--(d) 
        RETURN d
    ```