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
PHPORM-381 Add class metadata for vector search indexes (#2820)
* PHPORM-381 Add class metadata for vector search indexes
* Test SchemaManager with vector search
* Document the #[VectorSearchIndex] attribute
* Copilot review
Excluding ``name``, arguments are used to create the
@@ -1397,6 +1401,73 @@ for the related collection.
1397
1401
// rest of the class code...
1398
1402
}
1399
1403
1404
+
#[VectorSearchIndex]
1405
+
--------------------
1406
+
1407
+
.. _vector_search_index:
1408
+
1409
+
The ``#[VectorSearchIndex]`` attribute is used to define a vector search index
1410
+
on a document class. This enables efficient similarity search on vector fields,
1411
+
such as those used for machine learning embeddings.
1412
+
1413
+
Optional arguments:
1414
+
1415
+
- ``name``: (optional) The name of the vector search index. If omitted, a default name is used.
1416
+
- ``fields`` (required): A list of field definitions. Each field definition is an associative array describing a vector or filter field. For vector fields, the following keys are supported:
1417
+
1418
+
- ``type``: Must be set to ``'vector'`` for vector fields or ``'filter'`` for filter fields.
1419
+
- ``path``: The name of the field in the document to index.
1420
+
- ``numDimensions``: (vector fields only) The number of dimensions in the vector.
1421
+
- ``similarity``: (vector fields only) The vector similarity function to use. Supported values include ``'euclidean'``, ``'cosine'``, and ``'dotProduct'``. Use the constants from ``Doctrine\ODM\MongoDB\Mapping\ClassMetadata::VECTOR_SIMILARITY_*`` for best compatibility.
message:'#^Method Doctrine\\ODM\\MongoDB\\Tests\\Mapping\\ClassMetadataTest\:\:testEmptyVectorSearchIndexDefinition\(\) has parameter \$definition with no value type specified in iterable type array\.$#'
message:'#^Method Doctrine\\ODM\\MongoDB\\Tests\\Mapping\\ClassMetadataTest\:\:testSearchIndexDefinition\(\) has parameter \$definition with no value type specified in iterable type array\.$#'
0 commit comments