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
VinnySusanthVinnySusanth 

Problems with SOSL

Hi everyone,

 

I am facing a strange issue with an SOSL in my apex code.

My SOSL searches against a custom object called Keyword.

 

One of my keyword record has the value " Ivan systems,Mobile Systems,Solution Provider" in one of its long text area(32000) field.

 

String keywordTerm =null;
keywordTerm = 'Mobile*';
Set<Id> validAccountsSetNonFed = new Set<Id>();
validAccountsSetNonFed.add('0013000000AP7Hs');
List<List<SObject>> searchList=[FIND :keywordTerm in all fields returning Keyword__c(Account__c where Account__c IN :validAccountsSetNonFed limit 200)];
List<Keyword__c> accountsWithKeyWord = searchList[0];
System.debug('##########################:'+accountsWithKeyWord);

 

This SOSL returns 0 rows if i give the keywordTerm as 'Mobile*'.

But when i give it as 'Mobile* and *ivan*' it fetches me the record.

 

What could be the reason that this code snippet is behaving in this way.?

 

 

Thanks & Regards,

Vineetha

ipsita.biswas@in.v2solutions.comipsita.biswas@in.v2solutions.com

Hi Vinny,

 

Try this,

keywordTerm = 'Mobile%;

kandasmukandasmu

just keywordTerm = 'Mobile' should work. 

Shashikant SharmaShashikant Sharma

Use this

 

String EntId;
if(Apexpages.currentPage().getParameters().get('entityid') != null)
     EntId = Apexpages.currentPage().getParameters().get('entityid');
System.debug(' EntId : ' + EntId);