Hi Guys,
So i just can't get my filter expression to work with my query to filter on a boolean.
So i've simplified the query for now. I have a q term which returns 9 results.
My SitePageData (which is my basepage in my Site which is a Pagedata) has a NoIndex (boolean) property.
Now i want to filter the pages which that has NoIndex set to true on the page, but with the below filterexpression i cannot get this to work.
var results = SearchClient.Instance.UnifiedSearchFor(q)
.Filter(x => ((SitePageData)x).NoIndexFilters())
.GetResult();
public static FilterExpression<SitePageData> NoIndexFilters(this SitePageData sitePageData)
{
return new FilterExpression<SitePageData>(x =>
x.NoIndex.Match(true));
}
If i set the Match to true i just get all 9 results back.. if i set it to false, i get 0 results, which is just weird. Am i not using this correctly.
Just to check if stuff is working i changed the filter to just return pages of type ContentPages. And that seems to be working. Because out of my 9 pages, i get 3 back which are all of ContentPages. So this works, but my filter on the NoIndex Boolean doesnt.
public static FilterExpression<SitePageData> NoIndexFilters(this SitePageData sitePageData)
{
return new FilterExpression<SitePageData>(x =>
x.MatchTypeHierarchy(typeof(ContentPage)));
}
Any insight would be helpful..
regards,