Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi Joel,
The platform doesn't officially offer a "Contains" expression at this time (the feature is currently in the product backlog) but there is an undocumented behavior that may suffice for you until such a feature is implemented.
It so happens that the EqualToExpression, when used against a collection of the supported value types, will behave like a "contains" operation. So, if you apply an extension filter to your criteria (CompositeCriteria<TFilter,TExtension>.ExtensionFilter), which leverages the EqualToExpression against the Categories field, the results will actually be limited to those that contain the desired category.
For example:
var criteria = new CompositeCriteria<CommentFilter, TestData> { ExtensionFilter = FilterExpressionBuilder<TestData>.Field(td => td.Categories).EqualTo(categoryNameDefinedInBlock) }
While it's not an officially supported behavior, we have no plans to remove the behavior in the foreseeable future. I think that will acheive what you're looking to do in the near term.
Hi Chris,
Well that was a hidden suprise! Haven't tried it out yet, but if what you say is true you should promote this in your documentation! :) Will return with feedback if I get any issues with it.
Thanks!
Regards,
Joel Yourstone
Yes -- it's more of a convenient quirk at this point. It will certainly be documented when we introduce formal support in the form of a "contains" expression in the near future.
Hi all!
We're in the process of building an epi cms block that does what the title dictates, it gets the latest X comments (optional from comments on a product from a specific category) and displays them in a list.
We're not really sure how to manage this, however. First part is easy, getting the latest comments is just querying all Comments with the composite class Y we're using and sorting by date. The tricky part comes when we want to do it per category. All comments with composite class Y are tightly coupled with variants in episerver, however which categories a variant is included in does not exist in epi social, yet. It would make sense to create a
public List Categories { get; set; }
on the composite Y, since a varaint can be in several categories. Now, since we want to fetch all comments where
but I don't see any way of implementing this logic with the current commentrepository-API.
How can I solve this? It feels like a pretty common use case for comments, to show latest comments/ratings/reviews on a category page.