function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David Zhu 8David Zhu 8 

SOSL returns less rows than SOQL

Hi all,
I came across a problem that SOSL returns less rows than expected. SOQL returns the right number of rows.
Basically, in below snippet, I tried to get all rows which string 205640 exists in vin_person__c field.
SOSL only returns 2 rows. But SOQL return 6 rows including 2 rows in SOSL result.

What could be the problem?
 
list<list<sobject>> slist =[FIND '*205640*'  IN all FIELDS RETURNING VIN__c (Id,Name,Program__c,VIN_Person__c,Person__c,Car__c where Program__r.Account__c='001o000000ODW6lAAH' AND Inactive__c=FALSE ) LIMIT 100];

system.debug(slist);

list<vin__c> svin = [select Id,Name,Program__c,VIN_Person__c,Person__c,Car__c from vin__c where Program__r.Account__c='001o000000ODW6lAAH' AND VIN_Person__c LIKE '%205640%' AND Inactive__c=FALSE LIMIT 100];
system.debug(svin);



Thanks,
David
 
David Zhu 8David Zhu 8
I notice there is a pattern.
ie. 
if name is leading with a letter, like H205640, X205640,or A205640, it is in SOSL result.
If name is leading with a number, like 8205640,3205640, it is not included in sosl result.
How to resolve this issue?
Marcilio SouzaMarcilio Souza
I guess you don't need the first '*' in FIND '*205640*'
David Zhu 8David Zhu 8
I tried with and without *. They all returned the same results.
Santos edgard marquinaSantos edgard marquina
tengo el mismo problema con Film app  (https://filmapp.net)