4

I am using SOSL to search records in Salesforce. According to document http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_limit.htm, It should return 2000 records but it's only returning 500 records.

SOSL query: FIND {Not Given} RETURNING " +  "Lead(Id, Phone, FirstName, LastName)

I verified by running following SOQL query that more than 500 records exist for this criteria.

Select Id, Name from Lead where LastName like '%Not Given%'

One interesting thing to note is - this 500 limit seems to be per Object, not per query. Because on running following query

FIND {Not Given} RETURNING " +  "Lead(Id, Phone, FirstName, LastName), Account(Id)

It returns 500 leads and 13 Accounts.

Any suggestions where is this limit coming from?

EDIT: I tried to use Developer Console in Salesforce website and run SOSL query directly in it. It is also returning only 500 records. So Seems like this limit is like some organization wide limit. I asked our Salesforce admin but he couldn't find out.

I am using enterprise wsdl version no 28.0. Though using WSC-23.0 to generate classes from wsdl. Could this be an issue?

2

I believe the default batch size is 500 records and the maximum batch size permitted is 2000 records - this limit was increased as part of the Summer 13 release

The issue you are facing may be because you are using the older WSC-23.0 release. You should test with a newer API version to test that it resolves the issue.

On a related note, you can programatically change the batch size using queryMore()

| improve this answer | |
  • queryMore is not supported in search API. I'll have to try with latest WSC release. – RandomQuestion Jan 7 '14 at 0:34
0

Try to add "where part".

Example: Lead (Id where Id!=null). I don't know why but I had the same problem and it works with that.

| improve this answer | |
  • 1
    !=null is a performance killer because it will trigger a full table scan. If you're truly advising this, some more elaboration would be welcome. – Samuel De Rycke Jan 6 '14 at 15:51
0

look at the funnel example in the sosl limits.. it does not search in all records and it is not clear in how many records it searches...

http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_limits.htm

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.