Skip to content

Commit 6c953df

Browse files
committed
minor updates, mention of 'read-only', added a example listing
1 parent 7c55c69 commit 6c953df

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

modules/ROOT/pages/directives/indexes-and-constraints.adoc

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ await neoSchema.assertIndexesAndConstraints({ options: { create: true }});
257257
With the `@vector` GraphQL directive you can query your database to perform a vector index search.
258258
Queries are performed by passing in either a vector index or a query phrase.
259259

260-
A query by vector index finds nodes with a vector embedding similar to that index, a nearest neighbor search.
260+
A query by vector index finds nodes with a vector embedding similar to that index.
261+
That is, the query performs a nearest neighbor search.
261262

262263
In contrast, a query by phrase (a string of text) forwards the phrase to the link:https://neo4j.com/docs/cypher-manual/current/genai-integrations/[Neo4j GenAI plugin] and the plugin generates a vector embedding for it.
263-
This embedding is then compared to the node vector embeddings in the database and the result set.
264+
This embedding is then compared to the node vector embeddings in the database.
264265

265266
[NOTE]
266267
.Prerequisites
@@ -272,6 +273,11 @@ This embedding is then compared to the node vector embeddings in the database an
272273
* Queries by phrase require credentials for the Neo4j GenAI plugin.
273274
====
274275

276+
[NOTE]
277+
====
278+
Vector index searches are _read-only_ in the sense that no data is persisted in the database.
279+
====
280+
275281

276282
=== Definition
277283

@@ -294,18 +300,16 @@ input VectorIndexInput {
294300
queryName: String
295301
"""(Optional) The name of the provider."""
296302
provider: String
297-
"""(Optional) The name of the callback function."""
298-
callback: String
299303
}
300304
----
301305

302-
If the optional field `provider` is set, the type can be used for a query by phrase, otherwise for a query by vector index.
306+
If the optional field `provider` is set, the type is used for a query by phrase, otherwise for a query by vector index.
303307

304308
=== Usage
305309

306310
==== Query by vector index
307311

308-
Perform a nearest neighbor search by passing a vector index to your database and find nodes with a vector embedding similar to that index.
312+
Perform a nearest neighbor search by passing a vector index to find nodes with a vector embedding similar to that index.
309313

310314
.Type definition
311315
[source, graphql]
@@ -343,9 +347,23 @@ query FindSimilarProducts($vector: [Float]!) {
343347
}
344348
----
345349

350+
The input `$vector` is a list of `FLOAT` values and should look similar to this:
351+
352+
.Example query
353+
[source, graphql]
354+
----
355+
{
356+
"vector": [
357+
0.123456,
358+
...,
359+
0.654321,
360+
]
361+
}
362+
----
363+
346364
The query returns all `Product` nodes with a vector embedding on their `descriptionVector` property which is similar to the vector index argument `$vector`.
347365

348-
=== Query by phrase
366+
==== Query by phrase
349367

350368
Perform a query which utilizes the link:https://neo4j.com/docs/cypher-manual/current/genai-integrations/[Neo4j GenAI plugin] to create a vector embedding for a search phrase and then compares it to existing vector embeddings on nodes in the database.
351369

0 commit comments

Comments
 (0)