2

We are performing SOQL and SOSL operation to find particular value on an object. Please find below code:

    String searchCustomerMobileNo = '9999999999';

    Double mobileNo = Double.valueOf(searchCustomerMobileNo);

    List<Account> accList = [SELECT Id,Mobile__c,Name FROM Account WHERE Mobile__c = :mobileNo limit 50000];
    System.debug(accList +'\n SIZE: '+accList.size());    

    Search.SearchResults searchResults = Search.find('FIND \''+searchCustomerMobileNo+'\'  IN ALL FIELDS RETURNING  Account(id, name , Mobile__c   )');    
    List<Search.SearchResult> searchResultlist = searchResults.get('Account');
    System.debug('searchResultlist : '+searchResultlist+'\n SIZE: '+searchResultlist.size());

Result:

For SOQL --> SIZE: 414

For SOSL --> SIZE: 250

Here both SOQL and SOSL are searching for same data but, results produced by both queries differ i.e. SOSL result contains less data than SOQL result.

Why such a discrepancy in results for same operations? Please provide an explanation for such a behavior.

1 Answer 1

2

There seems to be a 250 records limit per entity.

This post may be useful for you

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .