mirror of
https://github.com/predis/predis.git
synced 2026-09-14 12:27:53 +00:00
Merge branch 'main' of https://github.com/predis/predis
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Predis\Command\Argument\Search\SchemaFields;
|
||||
|
||||
class VectorField implements FieldInterface
|
||||
class VectorField extends AbstractField
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
@@ -23,13 +23,17 @@ class VectorField implements FieldInterface
|
||||
* @param string $fieldName
|
||||
* @param string $algorithm
|
||||
* @param array $attributeNameValueDictionary
|
||||
* @param string $alias
|
||||
*/
|
||||
public function __construct(
|
||||
string $fieldName,
|
||||
string $algorithm,
|
||||
array $attributeNameValueDictionary
|
||||
array $attributeNameValueDictionary,
|
||||
string $alias = ''
|
||||
) {
|
||||
array_push($this->fieldArguments, $fieldName, 'VECTOR', $algorithm, count($attributeNameValueDictionary));
|
||||
$this->setCommonOptions('VECTOR', $fieldName, $alias);
|
||||
|
||||
array_push($this->fieldArguments, $algorithm, count($attributeNameValueDictionary));
|
||||
$this->fieldArguments = array_merge($this->fieldArguments, $attributeNameValueDictionary);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class VectorFieldTest extends TestCase
|
||||
public function testReturnsCorrectFieldArgumentsArray(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
['field_name', 'VECTOR', 'FLAT', 2, 'attribute_name', 'attribute_value'],
|
||||
(new VectorField('field_name', 'FLAT', ['attribute_name', 'attribute_value']))->toArray());
|
||||
['field_name', 'AS', 'field', 'VECTOR', 'FLAT', 2, 'attribute_name', 'attribute_value'],
|
||||
(new VectorField('field_name', 'FLAT', ['attribute_name', 'attribute_value'], 'field'))->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user