You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the `@vector` GraphQL directive you can query your database to perform a vector index search.
258
258
Queries are performed by passing in either a vector index or a query phrase.
259
259
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.
261
262
262
263
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.
264
265
265
266
[NOTE]
266
267
.Prerequisites
@@ -272,6 +273,11 @@ This embedding is then compared to the node vector embeddings in the database an
272
273
* Queries by phrase require credentials for the Neo4j GenAI plugin.
273
274
====
274
275
276
+
[NOTE]
277
+
====
278
+
Vector index searches are _read-only_ in the sense that no data is persisted in the database.
279
+
====
280
+
275
281
276
282
=== Definition
277
283
@@ -294,18 +300,16 @@ input VectorIndexInput {
294
300
queryName: String
295
301
"""(Optional) The name of the provider."""
296
302
provider: String
297
-
"""(Optional) The name of the callback function."""
298
-
callback: String
299
303
}
300
304
----
301
305
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.
303
307
304
308
=== Usage
305
309
306
310
==== Query by vector index
307
311
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.
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
+
346
364
The query returns all `Product` nodes with a vector embedding on their `descriptionVector` property which is similar to the vector index argument `$vector`.
347
365
348
-
=== Query by phrase
366
+
==== Query by phrase
349
367
350
368
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.
0 commit comments