Try our conversational search powered by Generative AI!

Filter Dictionary using an Array in Find


I have indexed YouTubeChannelInfo objects which contains many YouTube Channel information.

YouTubeChannelInfo has a Dictionary attribute called 'Playlists' which contains Playlist Title as the key and the ID as the value. Thus there could be many playlists for a given channel.

public class YouTubeChannelInfo

public string Name { get; set; } // Channel Name
public Dictionary<string, string> Playlists { get; set; } // Key - Playlist Title, Value - Playlist ID

I have string[] playlists which contains an array of playlist titles and need to filter only the YouTube Channels based on those playlist titles.

I have used

string[] playlists = GetPlaylists();

var result = client.Search<YouTubeChannelInfo>()
.Filter(v => playlists.Any(p => v.Playlists.ContainsKey(p)).Match(true))

This returns 0 results. How do I filter only the YouTube channels which has at least one playlist title in the string[] playlists ?

Edited, Mar 05, 2019 10:46

Hi Senura,

Have you looked into creating your own filter method:

You could possibly use the following on a complex object:

var searchQuery = client.Search<YouTubeChannelInfo>()
.Filter(x => x.Playlists.MatchContained(
a => a.Key, "Your Playlist Title"));

Have a look at the complex object filtering located here :



Edited, Mar 05, 2019 12:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.