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());
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.