PHP code example of partitech / doctrine-pgvector
1. Go to this page and download the library: Download partitech/doctrine-pgvector library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
partitech / doctrine-pgvector example snippets
/** @Column(type="vector") */
private $vector;
$query = $entityManager->createQuery(
'SELECT e FROM Entity e ORDER BY distance(e.vector, :inputVector) ASC'
);
$query->setParameter('inputVector', [0.1, 0.2, 0.3]);
$result = $query->getResult();