Questions tagged [sosl]

SOSL the Salesforce Object Search Language syntax. Use this tag for questions related to SOSL and handling query ouput.

Filter by
Sorted by
Tagged with
0
votes
1answer
161 views

How to use sosl query to get records based on string

FIND {ti} IN NAME FIELDS RETURNING Account LIMIT 10 above is my sosl query to get Account Names based on ti but the problem is,it also get the field values of website whose value contains ti.is there ...
3
votes
1answer
479 views

Trailhead: Invalid conversion from runtime type List to List: No type casting required

I'm a newbie to APEX but not the platform. Yes I'm going through the trailhead Apex Basics & Database and on the SOSL module I think I have this correct but I'm getting this List to List error: ...
0
votes
2answers
518 views

Convert SOQL Query to SOSL

I have a Query query = 'Select Id, Name, Email, Phone from Contact where (Id = ' + cstIdsList + ') ;' + 'Select Id, Name, Primary_Email__c, Phone from Account where (Id = ' + astIdsList + ') ...
1
vote
1answer
3k views

Query a Encrypted field in SOSL

I tried querying a Encrypted field in SOQL. Gives an error: encrypted field 'Email' cannot be filtered in a query call Can i achieve it using SOSL??
0
votes
1answer
2k views

To search Rich Text Area field [closed]

Custom field Cont__c, data type is Rich Text Area, but in the custom Visualforce Searchpage can't to search and error information: System.QueryException: field 'Cont__c' can not be filtered in ...
1
vote
1answer
553 views

SOSL query to return the count of all standard and custom objects from an org

Is there a simple SOSL query that one can use to determine the number of objects in an org? A bonus would be to determine what type of object it is (custom, standard, packaged) etc.
2
votes
1answer
520 views

Can the OR operator be used in SOSL queries?

Trying to do a SOSL query to find object matches for one of two variables. The following query is very simplified for easy reading. Any help is appreciated. String queryString = 'FIND :var1 OR :var2 ...
1
vote
1answer
222 views

Empty Result for SOSL Query List

New dev here and I am trying to make a SOSL query to pull accounts that contain a string variable. Not returning any results. Any guidance is appreciated Here's the vfp <apex:page controller="...
8
votes
1answer
1k views

Does SOSL allow the `-` dash character?

According to the documentation you need to escape the following special characters in SOSL search text. Escaping special characters & | ! ( ) { } [ ] ^ “ ~ * ? : \ ' The - dash character is ...
2
votes
1answer
101 views

SOSL working in dev org not working in sandbox [duplicate]

I am attempting to search for records that contain some text and limit the search results to a group of Ids. For simplicity, I'll remove the "search for text" part in this question. The problematic ...
1
vote
1answer
1k views

How do I change my SOQL below so that Shield Platform Encryption is supported on SSN and the query supports large amounts of data

Our company has several packages and we've recently been asked to do some analysis on how to make them compatible with Salesforce Shield field encryption. In the Shield encryption considerations doc, ...
0
votes
1answer
783 views

How to get all email type field values

How to get all email type field values in a salesforce lead record from a record id in apex class.
4
votes
1answer
192 views

SOSL Search Results incomplete?

I have the following SOSL: FIND {*ball*} IN ALL FIELDS RETURNING Campaign(Name, Subscription_Center_Description__c) I have the following 3 campaigns that SHOULD show up: Name: Sportsball, ...
4
votes
0answers
501 views

SOSL - Combining results from multiple objects into a single result set [closed]

If you query from multiple objects the SOSL query returns a List<List<SObject>>, with each inner List sorted by relevance inside. I want to return a combined mixed list sorted by relevance ...
4
votes
3answers
34k views

How to query child to parent

How to query child to parent like contact to parent..and how to query master lookup relations. select id,lastnam,(select id,name from account where accountid=conatctid)from contact
2
votes
2answers
1k views

I wanna run my SOSL to search for a string obtained by function parameter

I wanna search for a particular string obtained by my function parameter in Contact & Lead FirstName & LastName fields.. The difficulty is how to compose a SOQL statement for that,as I am ...
0
votes
2answers
72 views

How would I search for objects that begin with X

I'd like to be able to search for all leads, accounts, opportunities, etc. that begin with a character. I tried just typing one character and searching, but this resulted in "your search term must ...
2
votes
2answers
2k views

Method does not exist, is not static, or does not return the expected search results

Hi I'm doing the challenge for SOSL Queries and here is what I have accomplished so far. public class ContactAndLeadSearch { public static List < List < SObject >> searchList(String ...
10
votes
4answers
23k views

Only variable references are allowed in dynamic SOQL/SOSL

I'm trying to re-request an Asset from the database: asset = Database.query('SELECT ID, Price, Asset_MRR__c FROM Asset WHERE id =: ' + asset.id + ' limit 1'); But I get an error: Only variable ...
0
votes
0answers
302 views

Unable to Query the Deleted Records

I am able to see the deleted records in the Recycle Bin. But when we try to query the deleted records using the QueryAll/IsDeleted/AllRows keywords the query is not returning the records. However, ...
3
votes
1answer
657 views

How to use comparable interface to sort a list?

I need to use this wrapper class to sort the returned articles by the CaseAssociationCount in the KnowledgeArticle object. Just having a bit of trouble after getting the wrapper put together. Here is ...
2
votes
1answer
5k views

Get Knowledge Articles for custom lightning component

I am trying to build a lightning component that will be used as a help landing page for one of our products. So I will be filtering the data category from apex and further filters by search terms ...
0
votes
0answers
40 views

Sort Articles by CaseAssociationCount issues SOSL

Seems like Salesforce wont allow me to sort articles by caseassociation count as the parent. Any ideas how I can accomplish this? SOSL FIND {*searchTerms*} RETURNING KnowledgeArticleVersion (...
2
votes
1answer
300 views

Can we use SOSL to search content libraries

We are in the process of building a custom visual force page whose requirement is to search content libraries and files related to it based on a text entered on a search box. The requirement is to ...
2
votes
0answers
575 views

SOSL with multiple conditions not working

I have a SOSL search Query String suppliedSearchText1 = 'account'; Set<String> setselectedObjects = new Set<String>{'Account','contact'}; String SearchQuery = 'FIND \'' + ...
3
votes
1answer
653 views

SOSL Query against Custom setting object

I am experiencing some inconsistent behavior. On one org - I'm doing a SOSL (Search Query) against a custom setting and it works fine. But on a different org - I get entity type My_Custom_Setting__c ...
8
votes
1answer
1k views

Can we have a ORDER BY Clause in SOSL

I am running a SOSL Query and i want the results to be order by a particular field. System.QueryException: unexpected token: ORDER Here is the query i am building in my apex FIND 'Cisco Systems*' ...
3
votes
1answer
331 views

sosl exception on searching with one character

On doing a sosl search with just one character search parameter, I am getting an exception. To overcome this i have used custom error message in the catch block.However I am unable to cover the catch ...
1
vote
0answers
177 views

accessing related lookup in SOQL query

Hi I am writing a SOQL query. I use Fuse IT to check my SOQL queries. So the Query is: Select Id,Name,Material__r.APS_Account__r.FirstName, Material__r.APS_Account__r.LastName from Material_Order ...
2
votes
1answer
269 views

Can SOSL search deleted items

I'm implementing a custom view on deleted items (I'm making a 'Recycle Bin' type view for all objects of 1 type, regardless of who deleted them). So far, I'm getting the deleted items with SOQL with ...
4
votes
1answer
46 views

SOSL Behaving Differently in Spring16 vs Winter16

Has anyone else noticed a difference in SOSL on a Spring16 prerelease org? The code has not changed for over a year yet our custom search page has stopped finding results for search strings our end ...
1
vote
2answers
259 views

Full search in SFDC - Should I implement an external engine?

We have a collection of objects created by a third party application (from the AppExchange). The objects are basically job openings with information stored in many fields with different data types (...
1
vote
2answers
489 views

how to see Objects read permissions across profiles?

I have 13 object and i want to see for each object,how many profiles having Read permission.How can i achieve it? Please suggest. Sol-I am able to do it by creating list view in profile and filter ...
0
votes
1answer
5k views

SOQL quey to get page layouts Names for perticular object

Requirement:I need to find How many page layouts(Name) for particular Object using SOQL query or any other method,because I have 500 objects so i cannot check manually.Please suggest How can i ...
2
votes
1answer
835 views

Highlight relevant article text display on public knowledge base

I've tried searching but can't find anything to answer my question. We've got a customised version of PKB2 on a force.com site and I'm trying to update it so we can take advantage of keyword ...
2
votes
0answers
43 views

Search in related objects fields

Is there a way to make a single SOSL query to search in fields of related objects? For example: "find all tasks related to accounts are named X*".
3
votes
2answers
1k views

QueryLocator generates scope of the Object

I am recently working with building apex batch job and I came across Database.QueryLocator which I believe can create scope of the object which is passed to the execute() method. I do not understand ...
2
votes
3answers
1k views

API Names of all Objects to Excel

Requirement: How can i Extract API names of all object in One shot into an external file format such as Excel. I have 300 objects and I need API names of all of them. Please suggest.
5
votes
1answer
690 views

QueryException: Non-selective query against large object type (SOSL)

The following SOSL is in an Account trigger in a managed package: /* Trigger is on API 27.0 */ String acctsNamesOrd = 'PARKER/VANGUARD MGT'; Map<Integer, String> acctsNames = new Map<...
0
votes
1answer
57 views

I need to search data in account records for oerticular field

Requirement:- In account object i have one field with name approve_Profile__c. i have 1Lakh of account records. I need to check for this(approve_Profile__c) field for data. Select id,...
1
vote
1answer
1k views

What is the minimum length of SOSL search expression

While performing SOSL for one character I got exception "search term must be longer than one character", with more than one characters query is working fine. Is there any document from Salesforce ...
4
votes
1answer
287 views

Salesforce search engine vs SOSL

Below is my SOSL query - FIND {searchString} IN ALL FIELDS RETURNING Account(Id,Account_Number__c, RecordType.Name,Name LIMIT 16) 1) When I put searchString = '42430' in sosl query Query 1: ...
2
votes
1answer
395 views

System.UnexpectedException: Search unavailable thrown while deploying to prod

I am getting the following error while deploying to production : System.UnexpectedException: Search unavailable when executing an sosl search whithin my test class at the line where im doing the ...
1
vote
1answer
77 views

What is the difference between {searchString} and {searchString*} FIND clauses in SOSL

I run 2 SOSL queries - Query1: FIND {Athreya} IN ALL FIELDS RETURNING Account(Id,Account_Number__c, RecordType.Name,Name LIMIT 16) Result: 7 records whose field value contains 'Athreya' Query2: ...
1
vote
3answers
268 views

SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows)

We have over 100,000 contacts to query the system to get this error. SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows) However, this error is only ...
2
votes
0answers
186 views

GROUP BY Clause in SOSL (FIND instead of SELECT)

I am looking for the equivalent of the GROUP BY statement but then for a FIND query. I want to do a search on all fields of ContentVersion by a keyword and I want it to return a list of all values in ...
-1
votes
1answer
929 views

Result of sosl query convert to list and show in visualforce page

public List<sObject> sobjlst {get; set;} public void find() { if(searchText != null && searchText.length() > 1){ List<List<SObject>> results = [FIND :('*' + ...
3
votes
1answer
230 views

fixedSearchResults set in @testSetup method, but cannot access in testMethod

I'm new to salesforce, but have been given a task that I am puzzled on. I am given a test class with an @testSetup method which inserts relevant data for the test methods. In my test method, SOQL ...
3
votes
2answers
1k views

SOSL on Lookup Fields not working.

How do we write SOSL that searches lookup fields. Example My query looks this. "FIND \'Mark\' in all fields returning Account(Id, Name, User.Name)" Here it doesn't search User with keyword Mark. ...
1
vote
2answers
724 views

SOQL query giving error in salesforce

I am running a sample query in salesforce using jquery +Ajax but one of the query is giving me an error. query: select id from document__c where id not in (select entityid from topicassignment) ...