Skip to content

Commit 4a9e924

Browse files
initial
1 parent cb6614e commit 4a9e924

File tree

10 files changed

+161
-60
lines changed

10 files changed

+161
-60
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
** xref::values-and-types/spatial.adoc[]
6262
** xref::values-and-types/lists.adoc[]
6363
** xref::values-and-types/maps.adoc[]
64+
** xref::values-and-types/vector.adoc[]
6465
** xref:values-and-types/graph-references.adoc[]
6566
** xref::values-and-types/working-with-null.adoc[]
6667
** xref::values-and-types/casting-data.adoc[]

modules/ROOT/pages/constraints/managing-constraints.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ The allowed property types for property type constraints are:
401401
* `ZONED DATETIME`
402402
* `DURATION`
403403
* `POINT`
404+
* `VECTOR<TYPE>(DIMENSION)` label:new[Introduced in Neo4j 2025.mm]
404405
* `LIST<BOOLEAN NOT NULL>`
405406
* `LIST<STRING NOT NULL>`
406407
* `LIST<INTEGER NOT NULL>`

modules/ROOT/pages/functions/index.adoc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ Converts a `LIST<ANY>` of values to a `LIST<BOOLEAN>` values.
167167
If any values are not convertible to `BOOLEAN` they will be null in the `LIST<BOOLEAN>` returned.
168168

169169
1.1+| xref::functions/list.adoc#functions-tofloatlist[`toFloatList()`]
170-
| `toFloatList(input :: LIST<ANY>) :: LIST<FLOAT>`
170+
| `toFloatList(input :: VECTOR \| LIST<ANY>) :: LIST<FLOAT>`
171171
a|
172172
Converts a `LIST<ANY>` to a `LIST<FLOAT>` values.
173173
If any values are not convertible to `FLOAT` they will be null in the `LIST<FLOAT>` returned.
174174

175175
1.1+| xref::functions/list.adoc#functions-tointegerlist[`toIntegerList()`]
176-
| `toIntegerList(input :: LIST<ANY>) :: LIST<INTEGER>`
176+
| `toIntegerList(input :: VECTOR \| LIST<ANY>) :: LIST<INTEGER>`
177177
a|
178178
Converts a `LIST<ANY>` to a `LIST<INTEGER>` values.
179179
If any values are not convertible to `INTEGER` they will be null in the `LIST<INTEGER>` returned.
@@ -791,12 +791,29 @@ Vector functions allow you to compute the similarity scores of vector pairs.
791791
|===
792792
| Function | Signature | Description
793793

794+
1.1+| xref::functions/vector.adoc#functions-vector[`vector()`]
795+
| `vector(vectorValue :: STRING \| LIST<INTEGER \| FLOAT>, dimension :: INTEGER, coordinateType :: [INTEGER64, INTEGER32, INTEGER16, INTEGER8, FLOAT64, FLOAT32]) :: VECTOR`
796+
| label:new[Introduced in Neo4j 2025.xx]
797+
794798
1.1+| xref::functions/vector.adoc#functions-similarity-cosine[`vector.similarity.cosine()`]
795-
| `vector.similarity.cosine(a :: LIST<INTEGER \| FLOAT>, b :: LIST<INTEGER \| FLOAT>) :: FLOAT`
799+
| `vector.similarity.cosine(a :: VECTOR \| LIST<INTEGER \| FLOAT>, b :: VECTOR \| LIST<INTEGER \| FLOAT>) :: FLOAT`
796800
| Returns a `FLOAT` representing the similarity between the argument vectors based on their cosine.
797801

798802
1.1+| xref::functions/vector.adoc#functions-similarity-euclidean[`vector.similarity.euclidean()`]
799-
| `vector.similarity.euclidean(a :: LIST<INTEGER \| FLOAT>, b :: LIST<INTEGER \| FLOAT>) :: FLOAT`
803+
| `vector.similarity.euclidean(a :: VECTOR \| LIST<INTEGER \| FLOAT>, b :: VECTOR \| LIST<INTEGER \| FLOAT>) :: FLOAT`
800804
| Returns a `FLOAT` representing the similarity between the argument vectors based on their Euclidean distance.
801805

806+
1.1+| xref::functions/vector.adoc#functions-vector_dimension_count[`vector_dimension_count()`]
807+
| `(vector :: VECTOR) :: INTEGER`
808+
| Calculates the size of a vector. label:new[Introduced in Neo4j 2025.xx]
809+
810+
1.1+| xref::functions/vector.adoc#functions-vector_distance[`vector_distance()`]
811+
| `(vector1 :: VECTOR, vector2 :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, EUCLIDEAN_SQUARED, MANHATTAN, COSINE, DOT, HAMMING]) :: FLOAT`
812+
| Returns a `FLOAT` representing the distance between the two vector values based on the selected `vectorDistanceMetric` algorithm. label:new[Introduced in Neo4j 2025.xx]
813+
814+
1.1+| xref::functions/vector.adoc#functions-vector_norm[`vector_norm()`]
815+
| `vector_norm(vector :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, MANHATTAN]) :: FLOAT`
816+
| Returns a `FLOAT` representing the distance between the given vector and a vector of the same dimension with all coordinates set to zero, calculated using the specified `vectorDistanceMetric`. label:new[Introduced in Neo4j 2025.xx]
817+
802818
|===
819+

modules/ROOT/pages/functions/list.adoc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ The property named `likedColors` and a `LIST<ANY>` comprising all but the first
433433
| Any `BOOLEAN` value in `input` is preserved.
434434
| If the `input` is `null`, `null` will be returned.
435435
| If the `input` is not a `LIST<ANY>`, an error will be returned.
436-
| The conversion for each value in `list` is done according to the xref::functions/scalar.adoc#functions-tobooleanornull[`toBooleanOrNull()` function].
436+
| The conversion for each value in `input` is done according to the xref::functions/scalar.adoc#functions-tobooleanornull[`toBooleanOrNull()` function].
437437

438438
|===
439439

@@ -470,19 +470,20 @@ toBooleanList(['a string', true, 'false', null, ['A','B']]) as mixedList
470470
.Details
471471
|===
472472
| *Syntax* 3+| `toFloatList(input)`
473-
| *Description* 3+| Converts a `LIST<ANY>` to a `LIST<FLOAT>` values. If any values are not convertible to `FLOAT` they will be null in the `LIST<FLOAT>` returned.
473+
| *Description* 3+| Converts a `LIST<ANY>` or a `VECTOR` to a `LIST<FLOAT>` values. If any values are not convertible to `FLOAT` they will be null in the `LIST<FLOAT>` returned.
474474
.2+| *Arguments* | *Name* | *Type* | *Description*
475-
| `input` | `LIST<ANY>` | A list of values to be converted into a list of floats.
475+
| `input` | `VECTOR` \| `LIST<ANY>` | A list of values or a vector value to be converted into a list of floats.
476476
| *Returns* 3+| `LIST<FLOAT>`
477477
|===
478478

479479
.Considerations
480480
|===
481481

482-
| Any `null` element in `list` is preserved.
483-
| Any `FLOAT` value in `list` is preserved.
482+
| Any `null` element in `input` is preserved.
483+
| Any `FLOAT` value in `input` is preserved.
484484
| If the `input` is `null`, `null` will be returned.
485-
| If the `input` is not a `LIST<ANY>`, an error will be returned.
485+
| If the `input` is not a `VECTOR` or `LIST<ANY>`, an error will be returned.
486+
| `input` accepts `VECTOR` values as of Neo4j 2025.xx
486487
| The conversion for each value in `input` is done according to the xref::functions/scalar.adoc#functions-tofloatornull[`toFloatOrNull()` function].
487488

488489
|===
@@ -520,9 +521,9 @@ toFloatList(['a string', 2.5, '3.14159', null, ['A','B']]) as mixedList
520521
.Details
521522
|===
522523
| *Syntax* 3+| `toIntegerList(input)`
523-
| *Description* 3+| Converts a `LIST<ANY>` to a `LIST<INTEGER>` values. If any values are not convertible to `INTEGER` they will be null in the `LIST<INTEGER>` returned.
524+
| *Description* 3+| Converts a `LIST<ANY>` or a `VECTOR` to a `LIST<INTEGER>` values. If any values are not convertible to `INTEGER` they will be null in the `LIST<INTEGER>` returned.
524525
.2+| *Arguments* | *Name* | *Type* | *Description*
525-
| `input` | `LIST<ANY>` | A list of values to be converted into a list of integers.
526+
| `input` | `VECTOR` \| `LIST<ANY>` | A list of values or a vector value to be converted into a list of integers.
526527
| *Returns* 3+| `LIST<INTEGER>`
527528
|===
528529

@@ -532,7 +533,8 @@ toFloatList(['a string', 2.5, '3.14159', null, ['A','B']]) as mixedList
532533
| Any `null` element in `input` is preserved.
533534
| Any `INTEGER` value in `input` is preserved.
534535
| If the `input` is `null`, `null` will be returned.
535-
| If the `input` is not a `LIST<ANY>`, an error will be returned.
536+
| If the `input` is not a `VECTOR` or a `LIST<ANY>`, an error will be returned.
537+
| `input` accepts `VECTOR` values as of Neo4j 2025.xx
536538
| The conversion for each value in `list` is done according to the xref::functions/scalar.adoc#functions-tointegerornull[`toIntegerOrNull()` function].
537539

538540
|===
@@ -579,11 +581,11 @@ toIntegerList(['a string', 2, '5', null, ['A','B']]) as mixedList
579581
.Considerations
580582
|===
581583

582-
| Any `null` element in `list` is preserved.
583-
| Any `STRING` value in `list` is preserved.
584-
| If the `list` is `null`, `null` will be returned.
585-
| If the `list` is not a `LIST<ANY>`, an error will be returned.
586-
| The conversion for each value in `list` is done according to the xref::functions/string.adoc#functions-tostringornull[`toStringOrNull()` function].
584+
| Any `null` element in `input` is preserved.
585+
| Any `STRING` value in `input` is preserved.
586+
| If the `input` is `null`, `null` will be returned.
587+
| If the `input` is not a `LIST<ANY>`, an error will be returned.
588+
| The conversion for each value in `input` is done according to the xref::functions/string.adoc#functions-tostringornull[`toStringOrNull()` function].
587589

588590
|===
589591

modules/ROOT/pages/functions/vector.adoc

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
[[query-functions-vector]]
77
= Vector functions
88

9-
Vector functions allow you to compute the similarity scores of vector pairs.
10-
These vector similarity functions are identical to those used by Neo4j's {link-vector-indexes}[vector search indexes].
9+
Vector functions allow you to create `VECTOR` values, compute the similarity scores of vector pairs, and calculate the size of a vector.
10+
11+
[role=label--new-2025.xx]
12+
[[functions-vector]]
13+
== vector()
1114

1215

1316
[[functions-similarity-cosine]]
@@ -18,8 +21,8 @@ These vector similarity functions are identical to those used by Neo4j's {link-v
1821
| *Syntax* 3+| `vector.similarity.cosine(a, b)`
1922
| *Description* 3+| Returns a `FLOAT` representing the similarity between the argument vectors based on their cosine.
2023
.3+| *Arguments* | *Name* | *Type* | *Description*
21-
| `a` | `LIST<INTEGER \| FLOAT>` | A list representing the first vector.
22-
| `b` | `LIST<INTEGER \| FLOAT>` | A list representing the second vector.
24+
| `a` | `VECTOR` \| `LIST<INTEGER \| FLOAT>` | A list representing the first vector.
25+
| `b` | `VECTOR` \| `LIST<INTEGER \| FLOAT>` | A list representing the second vector.
2326
| *Returns* 3+| `FLOAT`
2427
|===
2528

@@ -36,6 +39,7 @@ For more details, see the {link-vector-indexes}#similarity-functions[vector inde
3639
| The implementation is identical to that of the latest available vector index provider (`vector-2.0`).
3740
| `vector.similarity.cosine()` returns the neighborhood of nodes along with their respective cosine similarity scores, sorted in descending order of similarity.
3841
The similarity score range from `0` and `1`, with scores closer to `1` indicating a higher degree of similarity between the indexed vector and the query vector.
42+
| The input arguments `a` and `b` accept `VECTOR` values as of Neo4j 2025.xx.
3943

4044
|===
4145

@@ -48,8 +52,8 @@ The similarity score range from `0` and `1`, with scores closer to `1` indicatin
4852
| *Syntax* 3+| `vector.similarity.euclidean(a, b)`
4953
| *Description* 3+| Returns a `FLOAT` representing the similarity between the argument vectors based on their Euclidean distance.
5054
.3+| *Arguments* | *Name* | *Type* | *Description*
51-
| `a` | `LIST<INTEGER \| FLOAT>` | A list representing the first vector.
52-
| `b` | `LIST<INTEGER \| FLOAT>` | A list representing the second vector.
55+
| `a` | `VECTOR` \| `LIST<INTEGER \| FLOAT>` | A list representing the first vector.
56+
| `b` | `VECTOR` \| `LIST<INTEGER \| FLOAT>` | A list representing the second vector.
5357
| *Returns* 3+| `FLOAT`
5458
|===
5559

@@ -66,6 +70,7 @@ For more details, see the {link-vector-indexes}#similarity-functions[vector inde
6670
| The implementation is identical to that of the latest available vector index provider (`vector-2.0`).
6771
| `vector.similarity.euclidean()` returns the neighborhood of nodes along with their respective Euclidean similarity scores, sorted in descending order of similarity.
6872
The similarity score range from `0` and `1`, with scores closer to `1` indicating a higher degree of similarity between the indexed vector and the query vector.
73+
| The input arguments `a` and `b` accept `VECTOR` values as of Neo4j 2025.xx.
6974

7075
|===
7176

@@ -124,4 +129,24 @@ This returns the two nearest neighbors.
124129
125130
======
126131

132+
[role=label--new-2025.xx]
133+
[[functions-vector_dimension_count]]
134+
== vector_dimension_count()
135+
136+
* `(vector :: VECTOR) :: INTEGER`
137+
* Calculates the size of a vector.
138+
139+
[role=label--new-2025.xx]
140+
[[functions-vector_distance]]
141+
== vector_distance()
142+
143+
* `(vector1 :: VECTOR, vector2 :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, EUCLIDEAN_SQUARED, MANHATTAN, COSINE, DOT, HAMMING]) :: FLOAT`
144+
* Returns a `FLOAT` representing the distance between the two vector values based on the selected `vectorDistanceMetric` algorithm.
145+
146+
147+
[role=label--new-2025.xx]
148+
[[functions-vector_norm]]
149+
== vector_norm()
127150

151+
* `vector_norm(vector :: VECTOR, vectorDistanceMetric :: [EUCLIDEAN, MANHATTAN]) :: FLOAT`
152+
* Returns a `FLOAT` representing the distance between the given vector and a vector of the same dimension with all coordinates set to zero, calculated using the specified `vectorDistanceMetric`.

modules/ROOT/pages/values-and-types/casting-data.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The following functions are available for casting data values:
1313
|===
1414
| Function | Description
1515

16-
| toBoolean() | Converts a `STRING`, `INTEGER`, or `BOOLEAN` value to a `BOOLEAN` value.
16+
| xref:functions/list.adoc#functions-toboolean[`toBoolean()`] | Converts a `STRING`, `INTEGER`, or `BOOLEAN` value to a `BOOLEAN` value.
1717

1818
| toBooleanList() | Converts a `LIST<ANY>` and returns a `LIST<BOOLEAN>` values.
1919
If any values are not convertible to `BOOLEAN` they will be `null` in the `LIST<BOOLEAN>` returned.
@@ -24,15 +24,15 @@ For any other input value, `null` will be returned.
2424
| toFloat() | Converts an `INTEGER`, `FLOAT`, or a `STRING` value to a `FLOAT` value.
2525
Otherwise `null` is returned.
2626

27-
| toFloatList() | Converts a `LIST<ANY>` and returns a `LIST<FLOAT>` values.
27+
| toFloatList() | Converts a `LIST<ANY>` or, as of Neo4j 2025.xx, a `VECTOR` and returns a `LIST<FLOAT>` values.
2828
If any values are not convertible to `FLOAT` they will be `null` in the `LIST<FLOAT>` returned.
2929

3030
| toFloatOrNull() | Converts an `INTEGER`, `FLOAT`, or a `STRING` value to a `FLOAT`.
3131
For any other input value, `null` will be returned.
3232

3333
| toInteger() | Converts a `BOOLEAN`, `INTEGER`, `FLOAT` or a `STRING` value to an `INTEGER` value.
3434

35-
| toIntegerList() | Converts a `LIST<ANY>` to a `LIST<INTEGER>` values. If any values are not convertible to `INTEGER` they will be null in the `LIST<INTEGER>` returned.
35+
| toIntegerList() | Converts a `LIST<ANY>` or, as of Neo4j 2025.xx, a `VECTOR` to a `LIST<INTEGER>` values. If any values are not convertible to `INTEGER` they will be null in the `LIST<INTEGER>` returned.
3636

3737
| toIntegerOrNull() | Converts a `BOOLEAN`, `INTEGER`, `FLOAT` or a `STRING` value to an `INTEGER` value.
3838
For any other input value, `null` will be returned.

modules/ROOT/pages/values-and-types/index.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ Rather, Cypher will automatically infer the data type of a given value.
77

88
More information about the data values and types supported by Cypher can be found in the following sections:
99

10-
* xref::values-and-types/property-structural-constructed.adoc[]
10+
* xref:values-and-types/property-structural-constructed.adoc[]
1111
* xref:values-and-types/boolean-numeric-string.adoc[]
1212
* xref::values-and-types/temporal.adoc[]
13-
* xref::values-and-types/spatial.adoc[]
14-
* xref::values-and-types/lists.adoc[]
15-
* xref::values-and-types/maps.adoc[]
13+
* xref:values-and-types/spatial.adoc[]
14+
* xref:values-and-types/lists.adoc[]
15+
* xref:values-and-types/maps.adoc[]
16+
* xref:values-and-types/vector.adoc[] label:new[Introduced in Neo4j 2025.xx]
1617
* xref:values-and-types/graph-references.adoc[]
1718
* xref::values-and-types/working-with-null.adoc[]
1819
* xref::values-and-types/casting-data.adoc[]

modules/ROOT/pages/values-and-types/ordering-equality-comparison.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ Values of different types are ordered based on a predefined hierarchy, from leas
4848
* xref::values-and-types/property-structural-constructed.adoc#structural-types[`RELATIONSHIP`]
4949
* xref::values-and-types/lists.adoc[`LIST`]
5050
* xref::patterns/fixed-length-patterns.adoc#path-patterns[`PATH`]
51+
* xref::values-and-types/vector.adoc[`VECTOR`] label:new[Introduced in Neo4j 2025.xx]
52+
* xref::values-and-types/spatial.adoc[`POINT`]
5153
* xref::values-and-types/temporal.adoc[`ZONED DATETIME`]
5254
* xref::values-and-types/temporal.adoc[`LOCAL DATETIME`]
5355
* xref::values-and-types/temporal.adoc[`DATE`]
5456
* xref::values-and-types/temporal.adoc[`ZONED TIME`]
5557
* xref::values-and-types/temporal.adoc[`LOCAL TIME`]
5658
* xref::values-and-types/temporal.adoc[`DURATION`]
57-
* xref::values-and-types/spatial.adoc[`POINT`]
5859
* xref::values-and-types/property-structural-constructed.adoc[`STRING`]
5960
* xref::values-and-types/property-structural-constructed.adoc[`BOOLEAN`]
6061
* Numbers: xref:values-and-types/property-structural-constructed.adoc[`INTEGER`, `FLOAT`]
@@ -144,3 +145,12 @@ If they have the same time and offset but different named time zones, they are s
144145
* Duration values cannot be directly compared.
145146
Since the length of a day, month, or year varies, Cypher does not define a strict ordering for durations.
146147
As a result, comparing two durations `(e.g, duration1 < duration2)` will always return `null`.
148+
149+
[[ordering-vector]]
150+
=== Ordering vector values
151+
152+
Similar to spatial values, vectors cannot be compared using the operators (<, >, >= and <=)
153+
154+
Vectors of different coordinate type values are ordered by the coordinate type, this means the current order is: INTEGER8, INTEGER16, INTEGER32, INTEGER64, FLOAT32, FLOAT64
155+
Within the same coordinate type, vectors are then ordered by their dimension, with smaller first (e.g Vector(1024) before Vector(2048)).
156+
Vectors of the same coordinate type and dimension are then ordered pairwise (similar to how lists are ordered e.g Vector([1, 2]) is ordered before a Vector([2, 1])).

0 commit comments

Comments
 (0)