Skip to content

Commit 4be53df

Browse files
committed
Add new GQLSTATUS codes for search
1 parent 3354df6 commit 4be53df

File tree

5 files changed

+235
-0
lines changed

5 files changed

+235
-0
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@
267267
**** xref:errors/gql-errors/42I66.adoc[]
268268
**** xref:errors/gql-errors/42I67.adoc[]
269269
**** xref:errors/gql-errors/42I68.adoc[]
270+
**** xref:errors/gql-errors/42I69.adoc[]
271+
**** xref:errors/gql-errors/42I70.adoc[]
272+
**** xref:errors/gql-errors/42I71.adoc[]
273+
**** xref:errors/gql-errors/42I72.adoc[]
270274
**** xref:errors/gql-errors/42N00.adoc[]
271275
**** xref:errors/gql-errors/42N01.adoc[]
272276
**** xref:errors/gql-errors/42N02.adoc[]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:page-role: new-2026.01 // TODO update to actual version when feature flag is removed
2+
= 42I69
3+
4+
== Status description
5+
error: syntax error or access rule violation - invalid search variable reference. `{ <<variable>> }` must reference a variable from the same MATCH statement.
6+
7+
== Example scenario
8+
9+
For example, when trying to use a variable from a previous `MATCH` statement as variable reference in a `SEARCH` clause:
10+
11+
[source,cypher]
12+
----
13+
MATCH (movie:Movie)
14+
MATCH (m:Movie {title:'Matrix, The'})
15+
SEARCH movie IN (
16+
VECTOR INDEX moviePlots
17+
FOR [1, 2, 3]
18+
LIMIT 5
19+
)
20+
RETURN movie.title AS title
21+
----
22+
23+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001].
24+
This error has a cause with GQLSTATUS 42I69 and status description:
25+
26+
27+
[source]
28+
----
29+
error: syntax error or access rule violation - invalid search variable reference. `movie` must reference a variable from the same MATCH statement.
30+
----
31+
32+
ifndef::backend-pdf[]
33+
[discrete.glossary]
34+
== Glossary
35+
36+
include::partial$glossary.adoc[]
37+
endif::[]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
:page-role: new-2026.01 // TODO update to actual version when feature flag is removed
2+
= 42I70
3+
4+
== Status description
5+
error: syntax error or access rule violation - search clause with multiple bound variables.In order to have a search clause, a MATCH statement can only have one bound variable.
6+
7+
[#_example_scenario]
8+
== Example scenario
9+
10+
For example, when trying to use a `SEARCH` clause in a `MATCH` statement with more than one bound variable:
11+
12+
[source,cypher]
13+
----
14+
MATCH (movie:Movie)-[r]->()
15+
SEARCH movie IN (
16+
VECTOR INDEX moviePlots
17+
FOR [1, 2, 3]
18+
LIMIT 5
19+
)
20+
RETURN movie.title AS title, r.prop AS prop
21+
----
22+
23+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001].
24+
This error has a cause with GQLSTATUS 42I70 and the status description above.
25+
26+
== Possible solution
27+
The first iteration of the `SEARCH` clause comes with many restrictions on the `MATCH` statement.
28+
It is likely that some of these restriction will be lifted in future versions of Neo4j.
29+
For the time being, the Cypher query under xref:errors/gql-errors/42I70.adoc#_example_scenario[Example scenario] can be rewritten like this:
30+
31+
[source,cypher]
32+
----
33+
MATCH (movie:Movie)
34+
SEARCH movie IN (
35+
VECTOR INDEX moviePlots
36+
FOR [1, 2, 3]
37+
LIMIT 5
38+
)
39+
MATCH (movie)-[r]->()
40+
RETURN movie.title AS title, r.prop AS prop
41+
----
42+
43+
ifndef::backend-pdf[]
44+
[discrete.glossary]
45+
== Glossary
46+
47+
include::partial$glossary.adoc[]
48+
endif::[]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
:page-role: new-2026.01 // TODO update to actual version when feature flag is removed
2+
= 42I71
3+
4+
== Status description
5+
error: syntax error or access rule violation - search clause with invalid predicates.In order to have a search clause, a MATCH statement can only have predicates on the bound node or relationship.
6+
7+
[#_example_scenario]
8+
== Example scenario
9+
10+
For example, when trying to use a `SEARCH` clause in a `MATCH` statement with predicates on other parts of the pattern than the bound variable:
11+
12+
[source,cypher]
13+
----
14+
MATCH (movie:Movie)-[]->(:Actor)
15+
SEARCH movie IN (
16+
VECTOR INDEX moviePlots
17+
FOR [1, 2, 3]
18+
LIMIT 5
19+
)
20+
RETURN movie.title AS title
21+
----
22+
23+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001].
24+
This error has a cause with GQLSTATUS 42I71 and the status description above.
25+
26+
== Possible solution
27+
The first iteration of the `SEARCH` clause comes with many restrictions on the `MATCH` statement.
28+
It is likely that some of these restriction will be lifted in future versions of Neo4j.
29+
For the time being, the Cypher query under xref:errors/gql-errors/42I71.adoc#_example_scenario[Example scenario] can be rewritten like this:
30+
31+
[source,cypher]
32+
----
33+
MATCH (movie:Movie)
34+
SEARCH movie IN (
35+
VECTOR INDEX moviePlots
36+
FOR [1, 2, 3]
37+
LIMIT 5
38+
)
39+
MATCH (movie)-[]->(:Actor)
40+
RETURN movie.title AS title
41+
----
42+
43+
ifndef::backend-pdf[]
44+
[discrete.glossary]
45+
== Glossary
46+
47+
include::partial$glossary.adoc[]
48+
endif::[]
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
:page-role: new-2026.01 // TODO update to actual version when feature flag is removed
2+
= 42I72
3+
4+
== Status description
5+
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.
6+
7+
[#_example_scenarios]
8+
== Example scenarios
9+
10+
For example, when trying to use a `SEARCH` clause in a `MATCH` statement with a pattern with several pattern parts:
11+
12+
[source,cypher]
13+
----
14+
MATCH (movie:Movie), ()
15+
SEARCH movie IN (
16+
VECTOR INDEX moviePlots
17+
FOR [1, 2, 3]
18+
LIMIT 5
19+
)
20+
RETURN movie.title AS title
21+
----
22+
23+
For example, when trying to use a `SEARCH` clause in a `MATCH` statement with a variable length:
24+
25+
[source,cypher]
26+
----
27+
MATCH (movie:Movie)-[]->{1,3}()
28+
SEARCH movie IN (
29+
VECTOR INDEX moviePlots
30+
FOR [1, 2, 3]
31+
LIMIT 5
32+
)
33+
RETURN movie.title AS title
34+
----
35+
36+
For example, when trying to use a `SEARCH` clause in a `MATCH` statement with a selector:
37+
38+
[source,cypher]
39+
----
40+
MATCH ANY SHORTEST ()-->(movie:Movie)
41+
SEARCH movie IN (
42+
VECTOR INDEX moviePlots
43+
FOR [1, 2, 3]
44+
LIMIT 5
45+
)
46+
RETURN movie.title AS title
47+
----
48+
49+
In all the above cases, you will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001].
50+
This error has a cause with GQLSTATUS 42I72 and the status description above.
51+
52+
== Possible solution
53+
The first iteration of the `SEARCH` clause comes with many restrictions on the `MATCH` statement.
54+
It is likely that some of these restriction will be lifted in future versions of Neo4j.
55+
For the time being, the Cypher queries under xref:errors/gql-errors/42I72.adoc#_example_scenarios[Example scenarios] can be rewritten like this:
56+
57+
[source,cypher]
58+
----
59+
MATCH (movie:Movie)
60+
SEARCH movie IN (
61+
VECTOR INDEX moviePlots
62+
FOR [1, 2, 3]
63+
LIMIT 5
64+
)
65+
MATCH (movie), ()
66+
RETURN movie.title AS title
67+
----
68+
69+
[source,cypher]
70+
----
71+
MATCH (movie:Movie)
72+
SEARCH movie IN (
73+
VECTOR INDEX moviePlots
74+
FOR [1, 2, 3]
75+
LIMIT 5
76+
)
77+
MATCH (movie)-[]->{1,3}()
78+
RETURN movie.title AS title
79+
----
80+
81+
[source,cypher]
82+
----
83+
MATCH (movie:Movie)
84+
SEARCH movie IN (
85+
VECTOR INDEX moviePlots
86+
FOR [1, 2, 3]
87+
LIMIT 5
88+
)
89+
MATCH ANY SHORTEST ()-->(movie)
90+
RETURN movie.title AS title
91+
----
92+
93+
ifndef::backend-pdf[]
94+
[discrete.glossary]
95+
== Glossary
96+
97+
include::partial$glossary.adoc[]
98+
endif::[]

0 commit comments

Comments
 (0)