You need to sign in to do that
Don't have an account?
SOSL query error
Hi All,
I am trying to create a search function in apex that contains SOSL. Here's my query :
String searchQry = 'FIND '\' ' + searchText + '\' ' ;
List<List<SObject>> searchList = search.query(searchQry);
However, i am getting an error - "Entities should be explictly specified in SOSL call in Apex". I do not want to specify the objects coz i want it to search all objects. According to the documentation, the RETURNING Clause is optional - http://www.salesforce.com/us/developer/docs/soql_sosl/index.htm.
If i add the object, the error goes away. Please help !
Regards
Shuchi
You can search multiple objects at the same time, but not all.
So do i have to specify the objects in the query ? I thought it was optional. Can you give me an example?
Can you share your SOSL query? That would be simpler to understand the issue.
I did:
String searchQry = 'FIND '\' ' + searchText + '\' ' ;
List<List<SObject>> searchList = search.query(searchQry);
searchText is anything like '000410' or 'ThinkGeek'.
list<list<sobject>> result = [
FIND:'Mission Specialist'
IN ALL FIELDS
RETURNING Contact (FirstName, LastName)
];