Replies: 1 comment 1 reply
-
Hey @revnelson, I don't believe there is a way to consistently prioritize your stores over regions by just using the query you have as-is. There will have to be modifications to your data model. It's not obvious to me what you'd have to do in order to achieve that off the top of my head. However, I'd actually recommend the Search plugin which creates a proxy collection named I believe this plugin is perfect for your use-case. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
I have a collection of TopSellers that has a Store relationship as well as a Region relationship. I'd like to perform a single query that prioritizes the more granular Store match over the more broad Region match.
If I perform a query with
where
containing an{ OR: [ {store: {equals: givenStoreId},{region: {equals: givenRegionId}] }
and alimit
of 1, will a Store match reliably be returned even if there is also a Region match?That is, is the first field in an OR filter reliably returned first, even if there is a match in both OR fields?
I'd prefer not to search for a Store match and then if nothing is found perform an additional search for a Region match to reduce round trips.
Beta Was this translation helpful? Give feedback.
All reactions