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...
that would filter on our webserver instead of find's webserver, which isn't playing to find's strengths.
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.
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.