-
Notifications
You must be signed in to change notification settings - Fork 70
Description
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