-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Hey, I am having an issue filtering on multiple fields on the same relationship.
I have created a pull request adding a test to demonstrate this: #115.
it attempts to filter products that have books with name = book and page count = 100, using the following url:
/products?filters[book][name][$eq]=book&filters[book][page_count][$eq]=100
If you look at the sql generated:
SELECT * FROM "products" WHERE EXISTS ( SELECT * FROM "books" WHERE "products"."id" = "books"."product_id" AND "name" = ? ) AND EXISTS ( SELECT * FROM "books" WHERE "products"."id" = "books"."product_id" AND "page_count" = ? )
Because the EXISTS clauses are added separately for the same relationship, it returns products where there exists one book matching the first condition and there exists a (potentially different) book matching the second condition, rather than requiring a single book that matches both conditions simultaneously.
is this intended/am I creating the query correctly?