Skip to content

Commit 8b8a006

Browse files
Add notifications info.
1 parent 281d0ab commit 8b8a006

File tree

1 file changed

+44
-14
lines changed

1 file changed

+44
-14
lines changed

modules/ROOT/pages/query.adoc

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -333,40 +333,70 @@ Content-Type: application/json;charset=utf-8
333333
====
334334

335335

336-
== Query parameters
336+
== Server notifications
337337

338-
In order to speed up queries in repeated scenarios, avoid using literals and replace them with parameters wherever possible.
339-
This allows the server to cache query plans and can result in a significant performance improvement.
338+
If the server generates any link:{neo4j-docs-base-uri}/status-codes/current/notifications[notifications], they will be returned in the `notifications` key of the response object (as a list).
339+
Notifications include recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j.
340+
341+
====
342+
[discrete]
343+
=== Example request
344+
345+
[source, headers]
346+
----
347+
POST http://localhost:7474/db/neo4j/tx/commit
348+
Accept: application/json;charset=UTF-8
349+
Content-Type: application/json
350+
Authorization: Basic bmVvNGo6dmVyeXNlY3JldA==
351+
----
340352
341-
.Do -- Use query parameters
342353
[source, JSON]
343354
----
344355
{
345356
"statements": [
346357
{
347-
"statement": "MERGE (n:Person {name: $name, age: $age}) RETURN n",
358+
"statement": "MATCH p=shortestPath((:Person {name: $from})-[*]->(:Person {name: $to})) RETURN p",
348359
"parameters": {
349-
"name": "Alice",
350-
"age": 42
360+
"from": "Alice",
361+
"to": "Bob"
351362
}
352363
}
353364
]
354365
}
355366
----
356367
357-
.Do not -- Embed literals in query
358-
[source, JSON]
368+
[discrete]
369+
=== Example response
370+
371+
[source, headers]
372+
----
373+
200: OK
374+
Content-Type: application/json;charset=utf-8
375+
----
376+
377+
[source, JSON, role=nocollapse]
359378
----
360379
{
361-
"statements": [
380+
"results": [
381+
...
382+
],
383+
"notifications": [
362384
{
363-
"statement": "MERGE (n:Person {name: 'Alice', age: 42}) RETURN n",
385+
"code": "Neo.ClientNotification.Statement.UnboundedVariableLengthPattern",
386+
"severity": "INFORMATION",
387+
"title": "The provided pattern is unbounded, consider adding an upper limit to the number of node hops.",
388+
"description": "Using shortest path with an unbounded pattern will likely result in long execution times. It is recommended to use an upper limit to the number of node hops in your pattern.",
389+
"position": {
390+
"offset": 21,
391+
"line": 1,
392+
"column": 22
393+
}
364394
}
365-
]
395+
],
396+
...
366397
}
367398
----
368-
369-
See link:{neo4j-docs-base-uri}/cypher-manual/current/syntax/parameters/[Cypher Manual -> Parameters] for more information.
399+
====
370400

371401

372402
ifndef::backend-pdf[]

0 commit comments

Comments
 (0)