About this question
We are facing a strange error when running SOSL query in our production environment. We have a component that runs SOSL queries within a custom object, looking in all text fields When we run this SOSL in the component we receive 6 results, but, if we run the same SOSL directly in the Developer Console, we receive 29 results... Using the same user
Any idea what could be happening? Sharing Model is set to public read/write in the object
FIND {test} IN ALL FIELDS RETURNING Object__c( Id, Account__c, RecordTypeId WHERE Account__c = '001XXXXXXXXXXXX' )
We have a lightning component that invokes an @AuraEnabled method, without cache. The controller class is using with sharing, and the Custom Object has more than 25 million records loaded
({ retrieveObject: function(component) { const action = component.get('c.searchRelatedObjects'); action.setParams({ accountId: component.get('v.recordId'), keywords: component.get('v.keywords'), }); action.setCallback(this, response => { if (response.getState() === 'SUCCESS') { console.log(response.getReturnValue()); } }); $A.enqueueAction(action); }, });
public with sharing class ObjectProvider { @AuraEnabled public static String searchRelatedObjects(Id accId, String keywords) { try{ return JSON.stringify(ObjectSelector.searchByAccIdKeywords(accId, keywords)); }catch(Exception exc){ throw new AuraHandledException(exc.getMessage()); } } }
public class ObjectSelector { @AuraEnabled public static List<object__c> searchByAccIdKeywords(Id accId, String keywords) { return [ FIND :keywords IN all fields RETURNING Object__c(Id, Account__c WHERE Account__c = :accountId) ][0]; } }</object__c>