Predis to v2.2.2

This commit is contained in:
the-djmaze 2024-04-08 16:29:55 +02:00
parent 9510347d3a
commit 969dca5f7e
449 changed files with 22013 additions and 2 deletions

View file

@ -0,0 +1,40 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.aggregate/
*
* Run a search query on an index, and perform aggregate transformations
* on the results, extracting statistics etc. from them
*/
class FTAGGREGATE extends RedisCommand
{
public function getId()
{
return 'FT.AGGREGATE';
}
public function setArguments(array $arguments)
{
[$index, $query] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
parent::setArguments(array_merge(
[$index, $query],
$commandArguments
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.aliasadd/
*
* Add an alias to an index.
*/
class FTALIASADD extends RedisCommand
{
public function getId()
{
return 'FT.ALIASADD';
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.aliasdel/
*
* Remove an alias from an index.
*/
class FTALIASDEL extends RedisCommand
{
public function getId()
{
return 'FT.ALIASDEL';
}
}

View file

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.aliasupdate/
*
* Add an alias to an index. If the alias is already associated with another index,
* FT.ALIASUPDATE removes the alias association with the previous index.
*/
class FTALIASUPDATE extends RedisCommand
{
public function getId()
{
return 'FT.ALIASUPDATE';
}
}

View file

@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Argument\Search\SchemaFields\FieldInterface;
use Predis\Command\Command as RedisCommand;
class FTALTER extends RedisCommand
{
public function getId()
{
return 'FT.ALTER';
}
public function setArguments(array $arguments)
{
[$index, $schema] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
$schema = array_reduce($schema, static function (array $carry, FieldInterface $field) {
return array_merge($carry, $field->toArray());
}, []);
array_unshift($schema, 'SCHEMA', 'ADD');
parent::setArguments(array_merge(
[$index],
$commandArguments,
$schema
));
}
}

View file

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.config-get/
* @see https://redis.io/commands/ft.config-set/
*
* Container command corresponds to any FT.CONFIG *.
* Represents any FUNCTION command with subcommand as first argument.
*/
class FTCONFIG extends RedisCommand
{
public function getId()
{
return 'FT.CONFIG';
}
}

View file

@ -0,0 +1,47 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Argument\Search\SchemaFields\FieldInterface;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.create/
*
* Create an index with the given specification
*/
class FTCREATE extends RedisCommand
{
public function getId()
{
return 'FT.CREATE';
}
public function setArguments(array $arguments)
{
[$index, $schema] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
$schema = array_reduce($schema, static function (array $carry, FieldInterface $field) {
return array_merge($carry, $field->toArray());
}, []);
array_unshift($schema, 'SCHEMA');
parent::setArguments(array_merge(
[$index],
$commandArguments,
$schema
));
}
}

View file

@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
class FTCURSOR extends RedisCommand
{
public function getId()
{
return 'FT.CURSOR';
}
public function setArguments(array $arguments)
{
[$subcommand, $index, $cursorId] = $arguments;
$commandArguments = (!empty($arguments[3])) ? $arguments[3]->toArray() : [];
parent::setArguments(array_merge(
[$subcommand, $index, $cursorId],
$commandArguments
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.dictadd/
*
* Add terms to a dictionary.
*/
class FTDICTADD extends RedisCommand
{
public function getId()
{
return 'FT.DICTADD';
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.dictdel/
*
* Delete terms from a dictionary.
*/
class FTDICTDEL extends RedisCommand
{
public function getId()
{
return 'FT.DICTDEL';
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.dictdump/
*
* Dump all terms in the given dictionary.
*/
class FTDICTDUMP extends RedisCommand
{
public function getId()
{
return 'FT.DICTDUMP';
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
class FTDROPINDEX extends RedisCommand
{
public function getId()
{
return 'FT.DROPINDEX';
}
public function setArguments(array $arguments)
{
[$index] = $arguments;
$commandArguments = [];
if (!empty($arguments[1])) {
$commandArguments = $arguments[1]->toArray();
}
parent::setArguments(array_merge(
[$index],
$commandArguments
));
}
}

View file

@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.explain/
*
* Return the execution plan for a complex query.
*/
class FTEXPLAIN extends RedisCommand
{
public function getId()
{
return 'FT.EXPLAIN';
}
public function setArguments(array $arguments)
{
[$index, $query] = $arguments;
$commandArguments = [];
if (!empty($arguments[2])) {
$commandArguments = $arguments[2]->toArray();
}
parent::setArguments(array_merge(
[$index, $query],
$commandArguments
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.info/
*
* Return information and statistics on the index.
*/
class FTINFO extends RedisCommand
{
public function getId()
{
return 'FT.INFO';
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.profile/
*
* Perform a FT.SEARCH or FT.AGGREGATE command and collects performance information.
*/
class FTPROFILE extends RedisCommand
{
public function getId()
{
return 'FT.PROFILE';
}
public function setArguments(array $arguments)
{
[$index, $arguments] = $arguments;
parent::setArguments(array_merge(
[$index],
$arguments->toArray()
));
}
}

View file

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.search/
*
* Search the index with a textual query, returning either documents or just ids
*/
class FTSEARCH extends RedisCommand
{
public function getId()
{
return 'FT.SEARCH';
}
public function setArguments(array $arguments)
{
[$index, $query] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
parent::setArguments(array_merge(
[$index, $query],
$commandArguments
));
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
class FTSPELLCHECK extends RedisCommand
{
public function getId()
{
return 'FT.SPELLCHECK';
}
public function setArguments(array $arguments)
{
[$index, $query] = $arguments;
$commandArguments = [];
if (!empty($arguments[2])) {
$commandArguments = $arguments[2]->toArray();
}
parent::setArguments(array_merge(
[$index, $query],
$commandArguments
));
}
}

View file

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.sugadd/
*
* Add a suggestion string to an auto-complete suggestion dictionary.
*/
class FTSUGADD extends RedisCommand
{
public function getId()
{
return 'FT.SUGADD';
}
public function setArguments(array $arguments)
{
[$key, $string, $score] = $arguments;
$commandArguments = (!empty($arguments[3])) ? $arguments[3]->toArray() : [];
parent::setArguments(array_merge(
[$key, $string, $score],
$commandArguments
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.sugdel/
*
* Delete a string from a suggestion index.
*/
class FTSUGDEL extends RedisCommand
{
public function getId()
{
return 'FT.SUGDEL';
}
}

View file

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.sugget/
*
* Get completion suggestions for a prefix.
*/
class FTSUGGET extends RedisCommand
{
public function getId()
{
return 'FT.SUGGET';
}
public function setArguments(array $arguments)
{
[$key, $prefix] = $arguments;
$commandArguments = (!empty($arguments[2])) ? $arguments[2]->toArray() : [];
parent::setArguments(array_merge(
[$key, $prefix],
$commandArguments
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.suglen/
*
* Get the size of an auto-complete suggestion dictionary.
*/
class FTSUGLEN extends RedisCommand
{
public function getId()
{
return 'FT.SUGLEN';
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.syndump/
*
* Dump the contents of a synonym group.
*/
class FTSYNDUMP extends RedisCommand
{
public function getId()
{
return 'FT.SYNDUMP';
}
}

View file

@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.synupdate/
*
* Update a synonym group
*/
class FTSYNUPDATE extends RedisCommand
{
public function getId()
{
return 'FT.SYNUPDATE';
}
public function setArguments(array $arguments)
{
[$index, $synonymGroupId] = $arguments;
$commandArguments = [];
if (!empty($arguments[2])) {
$commandArguments = $arguments[2]->toArray();
}
$terms = array_slice($arguments, 3);
parent::setArguments(array_merge(
[$index, $synonymGroupId],
$commandArguments,
$terms
));
}
}

View file

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis\Search;
use Predis\Command\Command as RedisCommand;
/**
* @see https://redis.io/commands/ft.tagvals/
*
* Return a distinct set of values indexed in a Tag field.
*/
class FTTAGVALS extends RedisCommand
{
public function getId()
{
return 'FT.TAGVALS';
}
}