GraphQL, filtering results from full text search in neo4j

Neo4j and neo4j-graphql-js is a really nice combo for creating a GraphQL-based backend and I particularly find the nested filtering parameter powerful. I was hoping to use this together with full-text indexing of nodes to build an app where you do keyword searches combined with various filtering selection. Unfortunately, this does not seem to be possible because filters are not supported yet for @cypher directive fields which is needed to utilize the full text-index.

Currently I use the following type:

type Query {
works (query: String):[Work] @cypher(
statement: "CALL db.index.fulltext.queryNodes('work', $query) yield node RETURN node"
)
}

and want to do queries like:

{
works(query: "Baskervilles"
filter:{
contributors_some:{name_contains: "Doyle"}
}){
title
contributors{
name
}
}
}

Any advice for workaround to solve this? or something that will be supported in the near future?
(Current idea for workaround is to rather rely on neo4j substring search using CONTAINS but this is somewhat awkward and not very efficient.)

1 Like

A lot of times the best thing to do is add the longer cypher query, so like as you said, the substring contains, variant. You can use the full power and functionality of cypher so if you can get it done with that it's the easiest route. Most of the built in filter methods, etc are for things like dates and numbers.

Stumbled upon the same limitation as @taalberg recently. I'm running the latest everything neo4j-graphql-js and Neo4j 4.0.0 but this functionality is still not there. Too bad.