Virtual Happy Hour is canceled this month (March) due to Good Friday.
Try our conversational search powered by Generative AI!
AI OnAI Off
Virtual Happy Hour is canceled this month (March) due to Good Friday.
Dear experts,
I am using CMS 6 R2 compatible version of Find. I want a functionality in find filters similar to string contain functionality.
I have the following data under Find Index overview for VPP folders
I have a simple list called "ExcludeFolders" which I need to use for a filter.:-
static IList ExcludeFolders = new List { "/Documents/", "/Accounts/" };
I am using a filter to exlude
if (ExcludeFolders.Count > 0)
{
foreach (var excludeFolders in ExcludeFolders)
{
filterForFolders = filterForFolders.And( x => (!x.MatchTypeHierarchy(typeof(UnifiedFile)) | !((UnifiedFile)x).VirtualPath.Match( excludeFolders)));
}
query = query.Filter(filterForFolders);
}
The above query is correct and giving me results only if the string values in my excludefolders list exactly match to the virtual path string. I uderstand this is the default functionality for Match.
However I want my filter to work like a "Contains" string function. i.e it should only look for certain words not the whole string and if it contains it, give me the result. But if I use that in above code !((UnifiedFile)x).VirtualPath.Contains( excludeFolders))); It starts complaining you cannot apply a filter to type bool. That means I need to use onl filter type method
Can I achieve the results using any existing filters of Episerver find?I would appreciate if I can get a sample example. .
Many thanks,