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

QuerySearch.setLimit is not applied to entire SOSL query #97

Open
joeythomaschaske opened this issue Jul 26, 2024 · 0 comments
Open

QuerySearch.setLimit is not applied to entire SOSL query #97

joeythomaschaske opened this issue Jul 26, 2024 · 0 comments

Comments

@joeythomaschaske
Copy link

The setLimit method of the QuerySearch class is not applying the limit to the entire SOSL search, it's applying it to the most recent Query object passed to the returning method.

I don't think this is correct. The limit should be applied to the entire SOSL query. If a user wants to set a specific limit for an object they should call the Query class's setLimit method before calling returning

This is nuanced but the docs do say there is a difference

You can set limits on individual objects or on an entire query.
When you set a limit on the entire query, results are evenly distributed among the objects returned. For example, let’s say you set an overall query limit of 20 and don’t define any limits on individual objects. If 19 of the results are accounts and 35 are contacts, then only 10 accounts and 10 contacts are returned.
FIND {test} RETURNING Account(id), Contact LIMIT 20
Setting individual object limits allows you to prevent results from a single object using up the maximum query limit before other objects are returned. For example, if you issue the following query, at most 20 account records can be returned, and the remaining number of records can be contacts.
FIND {test} RETURNING Account(id LIMIT 20), Contact LIMIT 100

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