Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-16-2019 09:39 AM
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?
11-16-2019 09:44 AM
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.
11-16-2019 10:10 AM
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
"""
)
11-16-2019 10:37 AM
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.
All the sessions of the conference are now available online