I'm using ServiceStack.Redis to implement a demo project. It contains two POCOs i.e Albums and its Songs.
Below is the search results measured using a stopwatch instance:
Time elapsed searching 5804 items is 00:00:00.1243984 <-- Albums
Time elapsed searching 138731 items is 00:00:02.0592068 <-- Songs
As you can see the search for the songs is taking too much time. I'm displaying the results in a WPF application wherein the search term is also entered. The lag is a no-go for redis.
Below is the code used for searching:
IEnumerable<int> songsFromRedis =
songRedis.GetAll()
.Where(song => song.Title != null
&& song.Title.ToLowerInvariant().Contains(searchText))
.OrderBy(song => song.Title)
.Select(x => x.AlbumId);
If we cannot make it any faster, would ElasticSearch help ?