|
| 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