I have a schema with a multi-value custom meta field. So when a component is published I'd like to retrieve it by the selected values in this meta field. I need to pull back the exact matches.
- I have Component A with field values val1, val2 and val3.
- I also have Component B with values val1.
- And I a Component C with values val3.
I am trying to construct a query to retrieve only Component A, i.e. val1 AND val2 AND val3.
We can't AND (
CustomMetaValueCriterias, as this will never yield true due to Custom Metas being separate records in the DB. It seems to be the same story as documented here: http://www.tridiondeveloper.com/odata-how-to-query-multiple-custom-metas/2
And of course, using an
OrCriteria yields unwanted items, which need to be filtered out on the application requiring delivery-side CPU cycles delaying the HTTP response.
My question is, is there an elegant way of using the CD API (perhaps via the Strategy or QueryResult classes) to achieve this? Or must I fall back to filtering my resultset manually via if/else conditions or using the Event System Hashing method (described here: http://www.tridiondeveloper.com/odata-how-to-query-multiple-custom-metas/4)?