London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
I'm using:
SearchClient.Instance.UnifiedSearch().For(searchQ)
as the basis for my search, afterwhich I've a bunch of filters I've already implented, but now I need to filter pages OUT that have a PageName that ends with "_Compare"...
I tried using "MatchContainedCaseInsensitive" like soo...
.Filter(x => !((PageData) x).PageName.MatchContainedCaseInsensitive(c => c.ToString(),"_Compare"));
but "c.ToString()" is wrong I think and I dont know what is the correct thing to put in there as "fieldSelector" as I've already selected "pagename".
Any help would be great please.
Try this after getting the result.
var result = SearchClient.Instance.UnifiedSearch().For(searchq).GetResult();
var endsWithResult = result .Where(x => !x.NameSearchable.EndsWith("_Compare"));
What I ended up doing was adding a property on the model that does the computation, then "includefield" adds that property to the index, which I can then compare directly...
.Filter(x => !((myCustomContentPage)x).ExcludeFromSearch.Match(true)); // where "ExcludeFromSearch" is my custom property that returns a bool.