I'm struggling doing something I though would be easy.
Here is the situation : I would like to filter a query based on a page property which is an IEnumerable. To be more precise, I'd like to filter pages that have exactly 10 items (for example). I tried many things but cannot make it work.
Here is what I tested with no luck :
search.Filter(page => page.Tags.Count().Match(10));
I also tried custom filters, but to no avail.
Any help would be really appreciated.
Create a separate property on the content type that calculates this but isn't stored in episerver and index that one instead?
Thanks a lot Daniel, it works. It was so simple, again thank you!
Tip: Instead of adding a new property, you could also add a convention for Count. Like this:
SearchClient.Instance.Conventions.ForInstancesOf<YourType>().IncludeField(x => x.Tags.Count());
That way, your original query will still work.Make sure the convention is added in an initializable module.
I'm interested in this approach, I'll test it.
Convention is even better yes :)