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
AtnMAtnM 

SOSL

Hi,

 

Is it possible to use SOSL in public sites. I have a search query that always returns 0. I know there are objects of the type I'm returning that match the query I'm passing in, and the public user has read access to the object. Do I need to enable search for the user some how? 

 

Thanks!

Scott

Best Answer chosen by Admin (Salesforce Developers) 
AtnMAtnM

Of course...

 

If your using a managed package you have to include the prefix on the object names in the SOSL query.

 

Thanks for the help,

Scott

 

All Answers

Scott JorgensenScott Jorgensen
Searching with SOSL should work fine.  Can you share some more details about what you're doing?
AtnMAtnM

Sure,

 

I'm trying to implement a simple search for our site. Just as a test I created the following controller:

 

 

public class SearchController extends ContentCore { public List<CustomObject__c> CustomObjects{get; set;} public List<List<SObject>> Results; public SearchController() { this.Results = [FIND 'A-*' IN ALL FIELDS RETURNING CustomObject__c(Id, Name)]; this.CustomObjects = (List<CustomObject__c>) this.Results[0]; } }

 

The name of the object is an auto generaged number A-{0000} and the search in the regular salesforce organization returns results. The public user has read all access

 

AtnMAtnM

Of course...

 

If your using a managed package you have to include the prefix on the object names in the SOSL query.

 

Thanks for the help,

Scott

 

This was selected as the best answer