PHP code example of gregpriday / laravel-scout-qdrant
1. Go to this page and download the library: Download gregpriday/laravel-scout-qdrant 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/ */
gregpriday / laravel-scout-qdrant example snippets
public function toSearchableArray()
{
return [
'id' => $this->id,
'name' => $this->name,
'vector' => $this->text,
// more attributes...
];
}
use GregPriday\LaravelScoutQdrant\Vectorizer\VectorizerInterface;
class MyVectorizer implements VectorizerInterface
{
public function embedDocument(string $text): array
{
// Create a vector from the text using your model
}
public function embedQuery(string $text): array
{
// Create a vector from the text using your model
}
}
return [
// other config values...
'vectorizer' => App\MyVectorizer::class,
];