You need to sign in to do that
Don't have an account?

Apex SOSL queries limited to 250 records per type
I'm running into some behavior with Apex SOSL queries in our managed package that I don't quite understand. Previously I was hitting a 200-record return limit on SOSL queries. After realizing this limit was increased to 2000 in API version 28, I changed our API version to the latest (32). Now I'm seeing us hit a limit of 250 records per type.
For instance, with the query:
List<List<SObject>> searchList = [FIND 'com' IN ALL FIELDS RETURNING Lead(Id), Account(Id)];
Results seem to be capped at 250 Leads and 250 Accounts returned. I can't find any documentation of such a limit. The only thing I can find is a way to increase the batchSize in QueryOptions for API-based SOSL queries, but I can't see anything that applies to Apex.
Any help? Thanks in advance!
For instance, with the query:
List<List<SObject>> searchList = [FIND 'com' IN ALL FIELDS RETURNING Lead(Id), Account(Id)];
Results seem to be capped at 250 Leads and 250 Accounts returned. I can't find any documentation of such a limit. The only thing I can find is a way to increase the batchSize in QueryOptions for API-based SOSL queries, but I can't see anything that applies to Apex.
Any help? Thanks in advance!
All Answers
What managed package you are using?
As per governor limits, 2000 recodes (api version above 28) can be fetched through sosl query.
Thanks,
Pratik
It's a managed package that my company is developing, but I'm running into the limit of 250 per record type not only in queries inside the managed package but also in the same code being run with Execute Anonymous in the Dev Console.
Thanks for the information. When you are not using the 'WHERE' clause the limit per entity becomes 250.
Thanks,
Pratik
Reference SOSL query returns only 250 records even if there are more than 2000+ records present (http://salesforce.stackexchange.com/q/77110/102)
Thanks.