GraphQL error / Invalid input 'S': expected 't/T' or 'l/L'

I'm trying to run a graphql query using neo4j-graphql jar plugin but am getting a really bizarre error I'm unable to track down.

Here's the error in plain text:

[GraphQL error]: Message: Exception while fetching data (/searchPodcast) : Invalid input 'S': expected 't/T' or 'l/L' (line 1, column 3 (offset: 2))
"CASE WHEN $content = '' THEN MATCH (n:Podcast) WHERE n.iTunesArtworkUrl600 IS NOT NULL RETURN n.LastModificationDate DESC, n.iTunesTrackCount DESC ELSE CALL db.index.fulltext.queryNodes('podcastSearch', $content) YIELD node WITH node as n RETURN n SKIP $offset LIMIT $limit END"
^, Location: [object Object], Path: searchPodcast

Any clues?

1 Like

Just found out that one can't do a MATCH inside a CASE. Will try to rewrite the logic but if someone has an idea as how to best reformat this, I'll be thankful.

While trying to recreate the query with apoc's when:

searchPodcast(offset: Int = 0, limit: Int = 15, content: String!): [Podcast]
     @cypher(
      statement: """
      CALL apoc.when($content = "", 'MATCH (n:Podcast) WHERE n.iTunesArtworkUrl600 IS NOT NULL RETURN n.LastModificationDate DESC, n.iTunesTrackCount DESC', 'CALL db.index.fulltext.queryNodes(\'podcastSearch\', $content) YIELD node WITH node as n RETURN n', {content: $content})
      YIELD value
      RETURN value.n SKIP $offset LIMIT $limit
      """
	)

Hey @malik - you've got some Cypher syntax errors in the queries used in the @cypher directive. I would suggest trying to run those queries in Neo4j Browser to get a better idea of where the Cypher syntax errors are so you can fix them.