Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 8 additions & 61 deletions modules/ROOT/pages/errors/gql-errors/42I72.adoc
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
= 42I72

== Status description
error: syntax error or access rule violation - search clause with too complex pattern. In order to have a search clause, a `MATCH` statement can only have a single node or relationship pattern and no selectors.
error: syntax error or access rule violation - search clause with too complex pattern. In order to have a search clause, a `MATCH` statement cannot have any selectors.

[#_example_scenarios]
== Example scenarios
[#_example_scenario]
== Example scenario

The following are examples of scenarios that will produce this error:

.Use of a `SEARCH` clause in a `MATCH` statement with a pattern with several pattern parts
[source,cypher]
----
Cypher 25
MATCH (movie:Movie), ()
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR [1, 2, 3]
LIMIT 5
)
RETURN movie.title AS title
----

.Use of a `SEARCH` clause in a `MATCH` statement with a variable length
[source,cypher]
----
CYPHER 25
MATCH (movie:Movie)-[]->{1,3}()
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR [1, 2, 3]
LIMIT 5
)
RETURN movie.title AS title
----
For example, when trying to match any shortest path to a movie and then use a `SEARCH` clause to filter the movies:

.Use of a `SEARCH` clause in a `MATCH` statement with a selector
[source,cypher]
Expand All @@ -47,40 +21,13 @@ MATCH ANY SHORTEST ()-->(movie:Movie)
RETURN movie.title AS title
----

In all of the above cases, you will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I72.
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I72.

== Possible solution
The first iteration of the `SEARCH` clause comes with many restrictions on the `MATCH` statement.
It is likely that some of these restriction will be lifted in future versions of Neo4j.
For the time being, the Cypher queries under xref:errors/gql-errors/42I72.adoc#_example_scenarios[Example scenarios] can be rewritten like this:

.Use of a `SEARCH` clause in a `MATCH` statement with a pattern with several pattern parts
[source,cypher]
----
CYPHER 25
MATCH (movie:Movie)
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR [1, 2, 3]
LIMIT 5
)
MATCH (movie), ()
RETURN movie.title AS title
----

.Use of a `SEARCH` clause in a `MATCH` statement with a variable length
[source,cypher]
----
CYPHER 25
MATCH (movie:Movie)
SEARCH movie IN (
VECTOR INDEX moviePlots
FOR [1, 2, 3]
LIMIT 5
)
MATCH (movie)-[]->{1,3}()
RETURN movie.title AS title
----
The first iteration of the `SEARCH` clause comes with some restrictions on the `MATCH` statement.
It is likely that some of these restriction will be lifted in future versions of Neo4j.
For the time being, you can rewrite the query to first find the movies and then filter them with a `SEARCH` clause, like this:

.Use of a `SEARCH` clause in a `MATCH` statement with a selector
[source,cypher]
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/errors/gql-errors/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ Status description:: error: syntax error or access rule violation - search claus

=== xref:errors/gql-errors/42I72.adoc[42I72]

Status description:: error: syntax error or access rule violation - search clause with too complex pattern. In order to have a search clause, a `MATCH` statement can only have a single node or relationship pattern and no selectors.
Status description:: error: syntax error or access rule violation - search clause with too complex pattern. In order to have a search clause, a `MATCH` statement cannot have any selectors.

=== xref:errors/gql-errors/42I73.adoc[42I73]

Expand Down
Loading