Skip to content

Add API request option for search to skip counting total results #2265

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

Open
zerocrates opened this issue Feb 28, 2025 · 0 comments
Open

Add API request option for search to skip counting total results #2265

zerocrates opened this issue Feb 28, 2025 · 0 comments

Comments

@zerocrates
Copy link
Member

Sometimes we're not interested in the total count for a request (we're getting the full results, or we just aren't going to look at the count at all), and getting the count runs another potentially expensive query.

We could introduce a request option to skip counting, and either return null for the count, or maybe better, just use PHP's count() to get the count of whatever the current request returned, if that option is set. Optimistically you could cut API response time in half for ones that skip the count, though the reality would be less. This would basically be the opposite of the "just get the count" feature we have when you pass a zero limit in the query.

Places we could use this would include the queries used to get options for select elements and other UIs that show all the options at once, probably the searchOne API helper method, and probably others.

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

No branches or pull requests

1 participant