O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using hashsets and sorted sets in redis to create a Trie

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required