We have a search query in which we insert a rather long filter expression using the below method:
public static ITypeSearch<TSource> ExcludeEntryCodes<TSource>(this ITypeSearch<TSource> search, IEnumerable<string> codes) where TSource : IBaseEntry { if (codes != null && codes.Any()) { var codeFilter = search.Client.BuildFilter<TSource>(); foreach (var code in codes) { codeFilter = codeFilter.And(x => !x.Code.Match(code)); } return search.Filter(codeFilter); } return search; }
Our issue is that if the list of "codes" are to long (around 20), Episerver Find returns a bad request. Any ways of optimizing the request?
In the error message is seems that the request towards Find gets rather verbose. Something like:
We have a search query in which we insert a rather long filter expression using the below method:
Our issue is that if the list of "codes" are to long (around 20), Episerver Find returns a bad request. Any ways of optimizing the request?
In the error message is seems that the request towards Find gets rather verbose. Something like: