Skip to content

Commit c54baa1

Browse files
committed
Allow for parameters in SHORTEST
1 parent 1c27d45 commit c54baa1

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,35 @@ New features are added to the language continuously, and occasionally, some feat
1616
This section lists all of the features that have been removed, deprecated, added, or extended in different Cypher versions.
1717
Replacement syntax for deprecated and removed features are also indicated.
1818

19+
[[cypher-deprecations-additions-removals-2025.01]]
20+
== Neo4j 2025.01
21+
22+
[cols="2", options="header"]
23+
|===
24+
| Feature
25+
| Details
26+
27+
a|
28+
label:functionality[]
29+
label:updated[]
30+
[source, cypher, role=noheader]
31+
----
32+
MATCH SHORTEST $param (:A)-[:R]->{0,10}(:B)
33+
----
34+
35+
[source, cypher, role=noheader]
36+
----
37+
MATCH p = ANY $param (:A)-[:R]->{0,10}(:B)
38+
----
39+
40+
[source, cypher, role=noheader]
41+
----
42+
MATCH SHORTEST $param GROUPS (:A)-[:R]->{0,10}(:B)
43+
----
44+
45+
a| Introduced the allowance of parameters to the xref:patterns/shortest-paths.adoc[SHORTEST and ANY path patterns].
46+
|===
47+
1948
[[cypher-deprecations-additions-removals-5.26]]
2049
== Neo4j 5.26
2150

modules/ROOT/pages/patterns/reference.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,10 @@ anyPathSearch ::= "ANY" [ numberOfPaths ] [ pathOrPaths ]
11651165
pathOrPaths ::= { "PATH" | "PATHS" }
11661166
11671167
1168-
numberOfPaths ::= unsignedDecimalInteger
1168+
numberOfPaths ::= unsignedDecimalInteger | parameter
11691169
11701170
1171-
numberOfGroups ::= unsignedDecimalInteger
1171+
numberOfGroups ::= unsignedDecimalInteger | parameter
11721172
----
11731173

11741174
[NOTE]

modules/ROOT/pages/patterns/shortest-paths.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Use Cypher if:
2020

2121
* You need to specify complex graph navigation via xref:patterns/variable-length-patterns.adoc#quantified-path-patterns[quantified path patterns].
2222
* Creating a link:https://neo4j.com/docs/graph-data-science/current/management-ops/graph-creation/graph-project/[graph projection] takes too long.
23-
* GDS is not available in your instance, or the size of the GDS projection is too large for your instance.
23+
* GDS is not available in your instance, or the size of the GDS projection is too large for your instance.
2424

2525
Use GDS if:
2626

@@ -65,7 +65,7 @@ CREATE (asc)-[:LINK {distance: 7.25}]->(cnm),
6565
(wof)-[:LINK {distance: 0.65}]->(wos)
6666
----
6767

68-
The paths matched by a xref:patterns/fixed-length-patterns.adoc#path-patterns[path pattern] can be restricted to only the shortest (by number of hops) by including the keyword `SHORTEST k`, where `k` is the number of paths to match.
68+
The paths matched by a xref:patterns/fixed-length-patterns.adoc#path-patterns[path pattern] can be restricted to only the shortest (by number of hops) by including the keyword `SHORTEST k`, where `k` is the number of paths to match, and can be either an `INTEGER` literal or a parameter which resolves to an `INTEGER`.
6969
For example, the following example uses `SHORTEST 1` to return the length of the shortest path between `Worcester Shrub Hill` and `Bromsgrove`:
7070

7171
.Query

0 commit comments

Comments
 (0)