|
| 1 | += 42I73 |
| 2 | + |
| 3 | +== Status description |
| 4 | +error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `{ <<expr>> }` must consist of one or more property predicates joined by `AND`, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). |
| 5 | + |
| 6 | +== Example scenarios |
| 7 | +For example, assuming that you have a vector index created by the following command: |
| 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 | + |
| 18 | +.Using `NOT` inside the `WHERE` subclause predicate in a `SEARCH` clause |
| 19 | +===== |
| 20 | +When trying to use `NOT` inside the `WHERE` subclause predicate in a `SEARCH` clause: |
| 21 | +
|
| 22 | +[source,cypher] |
| 23 | +---- |
| 24 | +CYPHER 25 |
| 25 | +MATCH (movie:Movie) |
| 26 | + SEARCH movie IN ( |
| 27 | + VECTOR INDEX moviePlots |
| 28 | + FOR [1, 2, 3] |
| 29 | + WHERE NOT movie.rating = 8 |
| 30 | + LIMIT 5 |
| 31 | + ) |
| 32 | +RETURN movie.title AS title, movie.rating AS rating |
| 33 | +---- |
| 34 | +
|
| 35 | +You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description: |
| 36 | +
|
| 37 | +[source] |
| 38 | +---- |
| 39 | +error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `NOT movie.rating = 8` must consist of one or more property predicates joined by AND, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). |
| 40 | +---- |
| 41 | +===== |
| 42 | + |
| 43 | +.Using multiple half-bounded ranges on the same property inside the `WHERE` subclause predicate in a `SEARCH` clause |
| 44 | +===== |
| 45 | +When trying to use multiple half-bounded ranges on the same property inside the `WHERE` subclause predicate in a `SEARCH` clause: |
| 46 | +
|
| 47 | +[source,cypher] |
| 48 | +---- |
| 49 | +CYPHER 25 |
| 50 | +MATCH (movie:Movie) |
| 51 | + SEARCH movie IN ( |
| 52 | + VECTOR INDEX moviePlots |
| 53 | + FOR [1, 2, 3] |
| 54 | + WHERE movie.rating > 6 AND movie.rating > 8 |
| 55 | + LIMIT 5 |
| 56 | + ) |
| 57 | +RETURN movie.title AS title, movie.rating AS rating |
| 58 | +---- |
| 59 | +
|
| 60 | +You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description: |
| 61 | +
|
| 62 | +[source] |
| 63 | +---- |
| 64 | +error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `movie.rating > 6 AND movie.rating > 8` must consist of one or more property predicates joined by AND, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). |
| 65 | +---- |
| 66 | +===== |
| 67 | + |
| 68 | +== Possible solution |
| 69 | +You can rewrite the predicates to comply with the vector search filter rules. |
| 70 | +For example, 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 > 8`. |
| 71 | +However, it is not always possible to rewrite the predicates. |
| 72 | +For the complete list of limitations, see link:https://neo4j.com/docs/cypher-manual/current/clauses/search/#limitations[Cypher Manual -> Limitations of the SEARCH clause]. |
| 73 | +ifndef::backend-pdf[] |
| 74 | +[discrete.glossary] |
| 75 | +== Glossary |
| 76 | + |
| 77 | +include::partial$glossary.adoc[] |
| 78 | +endif::[] |
0 commit comments