Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow choice of strategy when filtering by a sub-resource #168

Open
stoykostanchev opened this issue Sep 28, 2015 · 1 comment
Open

Allow choice of strategy when filtering by a sub-resource #168

stoykostanchev opened this issue Sep 28, 2015 · 1 comment
Labels

Comments

@stoykostanchev
Copy link

GET companies?include=owner&filter[budget][$gte]=10000&filter[owner.name][$ne]=Luis.

This query returns the companies with budget over 10000, whose owner is not Luis.
Imagine there are 20 companies and 20000 users. The current algorithm fetches all users, that are not named Luis, and adds a filter on the owner Id when looking for the companies.

We should allow the developer to use the reversed strategy -> fetch all companies first, add a company id filter when looking for the owners, that are not Luis, and after getting the results - remove of the initial set of companies the companies, whose owner didn't appear in the second query.

@henricook
Copy link

Hi @stoykostanchev!

Just to read this back to you

Currently: Gets all users $ne Luis (19999 users), then appends them all to the query ($ne userid1, $ne userid2 etc etc.) and runs a big ol' query on the companies table?

Desired: Get all the companies, Get Luis' user id, remove all companies with Luis' user id

Is that right?

Best Regards,

Henri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants