MacFJA / php-redisearch

PHP Client for RediSearch
MIT License
66 stars 9 forks source link

Feature: Handle RediSearch version specific feature #6

Closed MacFJA closed 2 years ago

MacFJA commented 3 years ago

Add a feature to detect RediSearch version to handle RediSearch capability depending on the version.

Some RediSearch features are not available in all versions of RediSearch 2.x To prevent sending incompatible request to RediSearch server, it would be create to catch those incompatibilities at the lib level.


To get the RediSearch version the command INFO Modules with a bit of filtering should give all the needed information, or a generic configuration added to all objects


This protective behavior should be deactivable, as it can cost (especially the RediSearch version requesting in Redis)

MacFJA commented 2 years ago

The RediSearch version detection is implemented (since c904606f4800c803216587b3d4349c84a907e754) in: https://github.com/MacFJA/php-redisearch/blob/c904606f4800c803216587b3d4349c84a907e754/src/Redis/Initializer.php#L93 (Usage: $version = \MacFJA\RediSearch\Redis\Initializer::getRediSearchVersion($redisClient))


All Redis commands for RediSearch have a parameter in their constructor to specify the version of RediSearch


High level classes (\MacFJA\RediSearch\Index and \MacFJA\RediSearch\Suggestions) use the version detection internally.


Issue is kept open until the release of the version 2.0.0