November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
It would be better to access the property strongly typed, instead og using «magic strings»?
Why do no need the get the value like this?
I think this approach is preferred, given IsEmployee is a boolean property:
var results = SearchClient.Instance.Search<Person>()
.Filter(p => p.IsEmployee.Match(true))
.GetContentResult();
I can't see the your entire convention in the comment, but if IsEmployee() is an extension method, just:
var results = SearchClient.Instance.Search()
.Filter(p => p.IsEmployee().Match(true))
.GetContentResult();
..if the return type is bool.
Hi!
It's not possible to filter on anything that is not indexed, so GetPropertyValue will not work for you. Sounds a bit weird that you cannot access the extension method if it's registered with SearchClient.Instance.Conventions.ForInstancesOf.
However, you can define your own extension method with whatever logic you want to return that boolean value and then include that field in the index:
public static bool IsEmployeeCustom(this Person person)
{
return person.GetPropertyValue("IsEmployee") == "True";
}
SearchClient.Instance.Conventions.ForInstancesOf<Person>()
.IncludeField(x => x.IsEmployeeCustom());
Then to filter:
SearchClient.Instance.Search<Person>()
.Filter(x => x.IsEmployeeCustom().Match(true));
Don't forget to re-index the persons. :)
The issue seems like indexing, Have you re-indexed your search after the changes?
I want to search the pages with GetPropertyValue(..) but I don't get any result with the below:
Is there a way to filter with the GetPropertyValue(..) for booleans like above?