mirror of
https://github.com/phpredis/phpredis.git
synced 2026-06-19 07:35:31 +00:00
Implement VSIM command
This command is similar to `VADD` in that it's pretty simple but allows
for a great many options.
In it's most basic form:
```php
// To get similarity of a different element
$redis->vsim('myvec', 'some-element');
// To get similarity for a vector of scores
```
As seen above the method attempts to infer element or vector from the
argument passed to $member`. However, since we do serialize the member
when doing `ELE` mode, the user can also specify `ELE` explicitly in the
options array to force an `ELE` search sending serialized values.
```php
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$redis->vsim('myvec', [3.14, 2.71], ['ELE']);
```
See #2543
This commit is contained in:
committed by
Michael Grunder
parent
286fa63064
commit
d1d690053f
@@ -1058,6 +1058,12 @@ class RedisCluster {
|
||||
*/
|
||||
public function vadd(string $key, array $values, mixed $element, array|null $options = null): RedisCluster|int|false;
|
||||
|
||||
/**
|
||||
* @see Redis::vsim
|
||||
*/
|
||||
public function vsim(string $key, mixed $member, array|null $options = null): Redis|array|false;
|
||||
|
||||
|
||||
/**
|
||||
* @see Redis::xack
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user