Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Filter Dictionary using an Array in Find

$
0
0

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))
.GetResult();

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


Viewing all articles
Browse latest Browse all 6894

Trending Articles