In this recipe, we will be using hedis to create simple trie in Redis. We will a use hashset to store an object, and store its searchable index in the sorted set in redis. We will be using the prefix trie to create a searchable index. For example, if we are searching for "APPLE", we will index all prefixes ("A","AP","APP","APPL", and "APPLE") in the index. Whenever a user enters a string to search, we will be able to look up our index and get the result.
Using hashsets and sorted sets in redis to create a Trie
Getting ready
Start the Redis server, and note down the connection info. In this recipe, we will assume that Redis is working on the same machine at the port...