Skip to content

Commit 9ce3df1

Browse files
committed
Document new error codes for vector search filtering.
1 parent 36ee635 commit 9ce3df1

File tree

5 files changed

+246
-0
lines changed

5 files changed

+246
-0
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
**** xref:errors/gql-errors/22NCF.adoc[]
178178
**** xref:errors/gql-errors/22ND1.adoc[]
179179
**** xref:errors/gql-errors/22ND2.adoc[]
180+
**** xref:errors/gql-errors/22ND3.adoc[]
180181
*** xref:errors/gql-errors/index.adoc#invalid-transaction-state[Invalid transaction state]
181182
**** xref:errors/gql-errors/25G02.adoc[]
182183
**** xref:errors/gql-errors/25N01.adoc[]
@@ -285,6 +286,9 @@
285286
**** xref:errors/gql-errors/42I66.adoc[]
286287
**** xref:errors/gql-errors/42I67.adoc[]
287288
**** xref:errors/gql-errors/42I68.adoc[]
289+
**** xref:errors/gql-errors/42I73.adoc[]
290+
**** xref:errors/gql-errors/42I74.adoc[]
291+
**** xref:errors/gql-errors/42I75.adoc[]
288292
**** xref:errors/gql-errors/42N00.adoc[]
289293
**** xref:errors/gql-errors/42N01.adoc[]
290294
**** xref:errors/gql-errors/42N02.adoc[]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
= 22ND3
2+
3+
== Status description
4+
error: data exception - wrong property for vector search filtering. The property `{ <<propKey>> }` has not been added as an additional property for the vector index `{ <<idx>> }`.
5+
6+
== Example scenario
7+
For example, assuming that you have a vector index created by
8+
9+
[source,cypher]
10+
----
11+
CYPHER 25
12+
CREATE VECTOR INDEX moviePlots
13+
FOR (m:Movie) ON m.embedding
14+
WITH [m.rating]
15+
----
16+
17+
When using another property key than `rating` in a vector search filter:
18+
19+
[source,cypher]
20+
----
21+
CYPHER 25
22+
MATCH (movie:Movie)
23+
SEARCH movie IN (
24+
VECTOR INDEX moviePlots
25+
FOR [1, 2, 3]
26+
WHERE movie.votes > 1000
27+
LIMIT 5
28+
)
29+
RETURN movie.title AS title
30+
----
31+
32+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 22ND3 and status description:
33+
34+
[source]
35+
----
36+
error: data exception - wrong property for vector search filtering. The property `votes` has not been added as an additional property for the vector index 'moviePlots'.
37+
----
38+
39+
== Possible solution
40+
If you want to use the property `votes` for vector search filtering, it must be an additional property of the vector index.
41+
This can be achieved by dropping and re-creating the vector index like this:
42+
43+
[source,cypher]
44+
----
45+
DROP INDEX moviePlots
46+
----
47+
48+
[source,cypher]
49+
----
50+
CYPHER 25
51+
CREATE VECTOR INDEX moviePlots
52+
FOR (m:Movie) ON m.embedding
53+
WITH [m.rating, m.votes]
54+
----
55+
56+
ifndef::backend-pdf[]
57+
[discrete.glossary]
58+
== Glossary
59+
60+
include::partial$glossary.adoc[]
61+
endif::[]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
= 42I73
2+
3+
== Status description
4+
error: syntax error or access rule violation - invalid predicate for vector search filtering. A vector search filter must consist of one or more predicates joined by AND, and the combined predicates for each property must specify either an exact value (e.g. x.prop = 1), an open range (e.g. x.prop >= 1), or a between range (e.g. x.prop > 1 AND x.prop < 100). `{ <<expr>> }` does not fulfill this.
5+
6+
== Example scenarios
7+
For example, assuming that you have a vector index created by:
8+
9+
[source,cypher]
10+
----
11+
CYPHER 25
12+
CREATE VECTOR INDEX moviePlots
13+
FOR (m:Movie) ON m.embedding
14+
WITH [m.rating]
15+
----
16+
17+
When trying to use `NOT` inside a vector search filter:
18+
19+
[source,cypher]
20+
----
21+
CYPHER 25
22+
MATCH (movie:Movie)
23+
SEARCH movie IN (
24+
VECTOR INDEX moviePlots
25+
FOR [1, 2, 3]
26+
WHERE NOT movie.rating = 8
27+
LIMIT 5
28+
)
29+
RETURN movie.title AS title, movie.rating AS rating
30+
----
31+
32+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description:
33+
34+
[source]
35+
----
36+
error: syntax error or access rule violation - invalid predicate for vector search filtering. A vector search filter must consist of one or more predicates joined by AND, and the combined predicates for each property must specify either an exact value (e.g. x.prop = 1), an open range (e.g. x.prop >= 1), or a between range (e.g. x.prop > 1 AND x.prop < 100). `NOT movie.rating = 8` does not fulfill this.
37+
----
38+
39+
When trying to use multiple open ranges on the same property inside a vector search filter:
40+
41+
[source,cypher]
42+
----
43+
CYPHER 25
44+
MATCH (movie:Movie)
45+
SEARCH movie IN (
46+
VECTOR INDEX moviePlots
47+
FOR [1, 2, 3]
48+
WHERE NOT movie.rating > 6 AND movie.rating > 8
49+
LIMIT 5
50+
)
51+
RETURN movie.title AS title, movie.rating AS rating
52+
----
53+
54+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description:
55+
56+
[source]
57+
----
58+
error: syntax error or access rule violation - invalid predicate for vector search filtering. A vector search filter must consist of one or more predicates joined by AND, and the combined predicates for each property must specify either an exact value (e.g. x.prop = 1), an open range (e.g. x.prop >= 1), or a between range (e.g. x.prop > 1 AND x.prop < 100). `movie.rating > 6 AND movie.rating > 8` does not fulfill this.
59+
----
60+
61+
== Possible solution
62+
Certain predicates are possible to rewrite so they adhere to the rules of vector search filtering.
63+
E.g. the predicate `NOT movie.rating < 7` can be rewritten to `movie.rating >= 7`, while the predicate `movie.rating > 6 AND movie.rating > 8` can be rewritten to `movie.rating > 6`.
64+
65+
ifndef::backend-pdf[]
66+
[discrete.glossary]
67+
== Glossary
68+
69+
include::partial$glossary.adoc[]
70+
endif::[]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
= 42I74
2+
3+
== Status description
4+
error: syntax error or access rule violation - wrong variable for vector search filtering. The variable `{ <<variable>>1 }` in a vector search filter property predicate must be the same as the search clause binding variable `{ <<variable>>2 }`.
5+
6+
== Example scenario
7+
For example, assuming that you have a vector index created by:
8+
9+
[source,cypher]
10+
----
11+
CYPHER 25
12+
CREATE VECTOR INDEX moviePlots
13+
FOR (m:Movie) ON m.embedding
14+
WITH [m.rating]
15+
----
16+
17+
When trying to use another variable than `movie` in the vector search filter in the following query:
18+
19+
[source,cypher]
20+
----
21+
CYPHER 25
22+
MATCH (m:Movie {title:'Matrix, The'})
23+
MATCH (movie:Movie)
24+
SEARCH movie IN (
25+
VECTOR INDEX moviePlots
26+
FOR m.embedding
27+
WHERE m.rating >= 8
28+
LIMIT 5
29+
)
30+
RETURN movie.title AS title, movie.rating AS rating
31+
----
32+
33+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I74 and status description:
34+
35+
[source]
36+
----
37+
error: syntax error or access rule violation - wrong variable for vector search filtering. The variable `m` in a vector search filter property predicate must be the same as the search clause binding variable `movie`.
38+
----
39+
40+
ifndef::backend-pdf[]
41+
[discrete.glossary]
42+
== Glossary
43+
44+
include::partial$glossary.adoc[]
45+
endif::[]
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
= 42I75
2+
3+
== Status description
4+
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>> }`.
5+
6+
== Example scenarios
7+
For example, assuming that you have a vector index created by:
8+
9+
[source,cypher]
10+
----
11+
CYPHER 25
12+
CREATE VECTOR INDEX moviePlots
13+
FOR (m:Movie) ON m.embedding
14+
WITH [m.rating]
15+
----
16+
17+
When trying to use the search binding variable `movie` in the `FOR` subclause in the following query:
18+
19+
[source,cypher]
20+
----
21+
CYPHER 25
22+
MATCH (movie:Movie)
23+
SEARCH movie IN (
24+
VECTOR INDEX moviePlots
25+
FOR movie.embedding
26+
LIMIT 5
27+
)
28+
RETURN movie.title AS title, movie.rating AS rating
29+
----
30+
31+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I75 and status description:
32+
33+
[source]
34+
----
35+
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`.
36+
----
37+
38+
When trying to use the search binding variable `movie` in the RHS of the predicate in the `WHERE` subclause in the following query:
39+
40+
[source,cypher]
41+
----
42+
CYPHER 25
43+
MATCH (m:Movie {title:'Matrix, The'})
44+
MATCH (movie:Movie)
45+
SEARCH movie IN (
46+
VECTOR INDEX moviePlots
47+
FOR m.embedding
48+
WHERE move.rating = movie.year
49+
LIMIT 5
50+
)
51+
RETURN movie.title AS title, movie.rating AS rating
52+
----
53+
54+
You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I75 and status description:
55+
56+
[source]
57+
----
58+
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`.
59+
----
60+
61+
ifndef::backend-pdf[]
62+
[discrete.glossary]
63+
== Glossary
64+
65+
include::partial$glossary.adoc[]
66+
endif::[]

0 commit comments

Comments
 (0)