Skip to content


Creating a Suggestion Index

Create a suggestion index called "MySuggestions":

use Ehann\RediSearch\Suggestion;

$suggestion = new Suggestion($redisClient, 'MySuggestions');

Adding a Suggestion

Add a suggestion with a score:

$suggestion->add('Tale of Two Cities', 1.10);

Getting a Suggestion

Pass a partial string to the get method:

$result = $suggestion->get('Cities');

Deleting a Suggestion

Pass the entire suggestion string to the delete method:

$result = $suggestion->delete('Tale of Two Cities');

Getting the Number of Possible Suggestions

Simply use the suggestion index's length method:

$numberOfPossibleSuggestions = $suggestion->length();