error: syntax error or access rule violation - self-referencing in vector search. The expression { [expr] } in the search clause may not depend on the search clause binding variable { [variable] }.
For example, assuming that you have a vector index created by the following command:
CYPHER 25
CREATE VECTOR INDEX moviePlots
FOR (m:Movie) ON m.embedding
WITH [m.rating]Example 1. Using the search binding variable in the
FOR subclause of a vector searchWhen trying to use the search binding variable movie in the FOR subclause in the following query:
CYPHER 25
MATCH (movie:Movie)
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR movie.embedding
LIMIT 5
)
RETURN movie.title AS title, movie.rating AS ratingYou will receive an error with GQLSTATUS 42001 with a cause with GQLSTATUS 42I75 and status description:
error: syntax error or access rule violation - self-referencing in vector search. The expression `movie.embedding` in the search clause may not depend on the search clause binding variable `movie`.Example 2. Using the search binding variable in the
WHERE subclause of a SEARCH clauseWhen trying to use the search binding variable movie in both the left-hand and right-hand side of the predicate in the WHERE subclause in the following query:
CYPHER 25
MATCH (m:Movie {title:'Matrix, The'})
MATCH (movie:Movie)
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR m.embedding
WHERE movie.rating = movie.year
LIMIT 5
)
RETURN movie.title AS title, movie.rating AS ratingYou will receive an error with GQLSTATUS 42001 with a cause with GQLSTATUS 42I75 and status description:
error: syntax error or access rule violation - self-referencing in vector search. The expression `movie.year` in the search clause may not depend on the search clause binding variable `movie`.