Try our conversational search powered by Generative AI!

.GreaterThan filter not working on List count?

Vote:
 

I'm trying to achieve filtering a result based on the Count-property of a List being greather than zero, like this:

query = query.Filter(u => u.SomeList.Count.GreaterThan(0));

This doesn't work, or rather it causes the search to return no hits. I've confirmed that there should be multiple valid results for this filter. 

Any idea what is wrong here?

#223991
Jun 09, 2020 8:30
Vote:
 

Managed to solve this by setting a client convention:

client.Conventions.ForInstancesOf<MyClass>().IncludeField(x => x.SomeList.Count());

Also had to reindex afterwards. 

#224004
Jun 09, 2020 9:39
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.