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
4
votes
3answers
38k 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
0
votes
1answer
222 views

SOSL on lookup fields

String query = 'FIND \'*' + searchString + '*\' IN ALL FIELDS RETURNING Ticket__C (Region__r.name, Manager__c, Manager__r.name, Name, Notes__c), user(id,Name)'; I am searching with user name and ...
-1
votes
1answer
296 views

Picklist related Query in salesforce

I Have a Picklist Field Like (Orderstatus__c) Field, Values are (A, B, C, D, E, F) This Picklist Field, when i am querying the Orderstatus__c Filed Those values will be displaying like Un order (B, E, ...
3
votes
2answers
570 views

SOSL: How to programmatically work out what field a search string is found in

As part of our continuing GDPR improvement, I've been tasked to easily find all records which reference an email address, telephone number or name, entered by a user as a text string. Then we want to ...
0
votes
1answer
350 views

SOSL and returned fields

In SOQL, if you don't specify the returned fields and then try to query them, you get an error. Is it the same in SOSL? List<List<sObject>> values = [FIND 'acme' IN ALL FIELDS RETURNING ...
3
votes
1answer
47 views

SOSL on Permission Sets error when no ID is included

I am testing SOSL's on Permission Sets for something I am building and noticed that if I don't include the ID in the fields to request, the search fails: An unexpected error occurred. Please ...
0
votes
1answer
270 views

Why do SOSL works after enabling Deterministic Encryption?

I have enabled Deterministic Encryption for my org, encrypted field Account.Name and created new Account 'MyAccount'. So, in my classes or in Developer Console I can search this account only by full ...
0
votes
1answer
32 views

How to get Two articles in One list using salesforce query

Hi every one I have a two articles: Offer__kav and Offer_order__kav. How to Query This Two Objects Related All Fields. For Ex: I tried : List<List<SObject>> search_results = [FIND 'SFDC'...
0
votes
1answer
168 views

How to Import/Query the 'EntityHistory' Object Data Through Data Loader in salesforce

i have some records/data, i mention in Excel File is in below, and i need How to Query the Records from "EntityHistory" Object... please Help me i will try my developer Edition.
1
vote
1answer
95 views

Combining result sets from SOSL query

When I query SOSL with multiple RETURNING objects, the result comes as a list of lists, each for a different sObjectType, each sorted by default by the "relevance" of each record in the result set. ...
0
votes
1answer
103 views

Search for related records?

I have a context aware (hasRecordId) Lightning component that can be dropped on an undetermined custom object record page. I need the component to grab the recordId, then search for that recordId ...
0
votes
1answer
358 views

SOSL Query Returning Only Empty Lists / No Results

I'm trying to use SOSL to locate Account, Contact, Lead, and Site__c records by Id using a dynamic string of matching ids obtained from Destination__c records. However, I'm not returning any records ...
10
votes
4answers
26k 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
2answers
1k views

dynamic SObjectType.getDescribe().isAccessible()?

I have a Lightning component with a search bar that uses Apex to search Cases, and another that searches Opportunities. For example: @AuraEnabled public static List<Case> searchCases(String ...
0
votes
1answer
784 views

How to search the Phone Field Records From All Objects using SOSL Query

i need to fetch the Phone Information from all Objects.. How i can get the Records... i tried this Below way .. but this is not Coorect... Why means for Example in my Organisation having 200 Objects ...
0
votes
0answers
21 views

Is this possible to get full text search results to find “FDD MatureApp” record using SOSL by search term “App” [duplicate]

To reproduce the problem, on a brand new fresh organization I have created two records insert new List<Account>{ new Account(Name = 'FDD App'), new Account(Name = 'FDD MatureApp') }; ...
4
votes
4answers
2k views

SOSL Queries returning empty lists

When you do a SOSL query - the result is in the form of multiple lists (one for each object you search). List<List<sObject>> resultsList = [FIND 'test' IN NAME FIELDS RETURNING ...
0
votes
1answer
117 views

How to use SOSL to query cross object

I have the following method that I'm using SOSL to search against the Product2 object: public PageReference searchProducts() { try { List<List<Product2>> searchResults = [FIND ...
3
votes
1answer
747 views

How to filter SOSL Query results effectively

We have a SOSL query that is searching multiple custom objects. The desired result is one search result pane that shows results from the multiple tables in one list. Because multiple custom objects ...
-1
votes
1answer
373 views

Without passing search term how to do query using sosl

I have run this sosl Query in editor,It gives zero records FIND {Doc*} IN ALL FIELDS RETURNING Document__c ( Revision__c,name,Release_Date__c,Part__c,Part__r.name,PartValueSOSL__c,PlatformSOSL__c,...
2
votes
1answer
89 views

SOSL having discrepant results than SOQL for same operation

We are performing SOQL and SOSL operation to find particular value on an object. Please find below code: String searchCustomerMobileNo = '9999999999'; Double mobileNo = Double.valueOf(...
3
votes
0answers
830 views

Salesforce limitation - SOSL search not returning records through keyword exists in the records

In our org there are more than 5 Millon CaseComment record exists. User will navigate from Account record and opens a page upon a button click. User enters the keyword and it should search on the ...
0
votes
3answers
1k views

Fetching Test data while executing SOSL query from Test class

My Visualforce page is calling Controller methods using apex:actionFunction and are not being executed while I am implementing the test class. Also in my test class I have test contact records which ...
0
votes
1answer
379 views

What is the purpose of wildcards (asterisks) before and after SOSL Query?

I can't understand the purpose of putting asterisks before and after the SOSL query below. Is it to cover searches for the wildcards just Jsmith when the user searches smith or smithj when the user ...
1
vote
1answer
976 views

Performing a relationship query in a SOSL query?

I have found myself in a bit of a problem... I am grabbing events and their attachments based on certain filter criteria so there is no problem getting attachments in SOQL. The problem comes with the ...
1
vote
2answers
368 views

SOSL for External Object

I have configured a Salesforce Connect relationship to an external data source using a custom Apex adapter. I am trying to configure one of the external objects to allow search. I have selected the "...
2
votes
0answers
91 views

Searching ContentDocument with SOSL 'Name Fields' appears to return documents with the search string in the content

It looks like when I issue a SOSL statement against NAME FIELDS in ContentDocument, I get documents that have the search string in the content as well. I really need it to just search the name fields,...
1
vote
2answers
705 views

SOSL search in master details objects

I have two object A__c(s1__c) and B__c(s2__c) and relationship among them is Master-details. I have to make a SOSL search in field of both(s1__c and s2__c). Find {searchText} Returning A__c(s1__c), ...
2
votes
2answers
194 views

SOSL Query returns an Error

I am trying to display related contacts on the record detail page based on the current Contact record id. For the related contacts, my SOSL as follows: String searchQuery = 'FIND \'' + firstName + ' ...
3
votes
1answer
200 views

SOSL - URL Encode necessary with Asterisks?

My chief question: does Salesforce's SOSL/Parameterized search accept * wildcard searches? Related q: Does URL encoding a url with search string parameters including asterisk and + characters ...
1
vote
0answers
201 views

SOSL Filter on Community Topics

Back in 2014 @pchittum had mentioned in the Discussion Forums that he hoped that maybe some day we might be able to filter by topics using SOSL: My wish is that some day in the future you can just ...
0
votes
0answers
116 views

Apex SOQL/SOSL Parser

Is there an Apex-based DML, SOQL and SOSL parser? I see the only way this could happen is during the time of deployment, I can use DeployDetails to get the list of SOQLs. Any pointers on how I can ...
1
vote
1answer
364 views

Invalid bind expression type of String for column of type Decimal. Auto type casting?

I ran into this exception while trying to make some dynamic SOQL queries(also SOSL but haven't gotten to test those yet). Basically I'm trying to build a query string and add a dynamic value as one ...
0
votes
1answer
74 views

: execution of BeforeUpdate caused by: System.QueryException: Non-selective query against large object type (more than 200000 rows)

I was wondering if someone can help me with the following queries. I'm getting the following errors when I try to run my trigger. The Records I'm returning is only 28 records: : execution of ...
0
votes
1answer
217 views

System.UnexpectedException: Search Term exceeded max length: in apex class

I am getting the below error: System.UnexpectedException: Search Term exceeded max length Using this query: String sosl = 'FIND {' + String.join(new List<String>(SAPs),' OR ') + '} IN ALL ...
2
votes
1answer
369 views

Field level security and UI search / API search

I have noticed that if I use field level security to hide a field for a custom profile, a user in the profile can still global search for text in that field and the record will appear in the results, ...
2
votes
1answer
1k views

Test Method for @HttpPost RestResource is not returning expected results

I have been looking all over the boards and found some useful posts regarding testing rest services, but even after spending the last 2 hours trying to implement many of those ideas, I still am stuck ...
-1
votes
1answer
3k views

Copy field values of one object to another object (Opp to Contract)

Hi Want to transfer the value from Opp to contract. Once Opp stage is CLOSED WON it is converted into New Contract. Req: Once Contract is created, i want to transfer/copy the same field values ...
0
votes
2answers
23 views

I have 1M records -some records are from data loader and there is no picklist restriction

I have 1M records -some records are from data loader and there is no picklist restriction I want to see uniuqe values for account object with that perticular values.
3
votes
2answers
840 views

Question about setFixedSearchResults() Apex Tests with SOSL

The documentation on preparing tests for code with SOQL queries includes the comment "Additionally, the test method can call Test.setFixedSearchResults multiple times to define different result sets ...
2
votes
1answer
1k views

Using encrypted fields in SOSL query gives in 0 results

My org has Classic encryption and I have a encrypted field in contact object. I am trying to use that field in SOSL. FIND {123456789} IN ALL FIELDS RETURNING CONTACT(NAME) This is returning 0 ...
-2
votes
1answer
415 views

What is the execution time spent in the database for an DML or SOQL or SOSL?

Is it possible to find the execution time for a DML or SOQL or SOSL? What are the factors on which the execution time of these queries depend?
5
votes
1answer
405 views

Sosl on FeedItems with network id

I am trying to query for FeedItems that belong to a specific community as follows: FIND {searchTerm} RETURNING FeedItem(Id,Title,Body) WITH NETWORK IN ('SomeID') However, I noticed that the query ...
3
votes
2answers
513 views

Number of currently logged users to the community

I trying display number of currently logged users to the community in my lightning component. Now I using below SOQL query: List<AggregateResult> numberCurrentlyLogged = [SELECT ...
4
votes
1answer
301 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: ...
1
vote
0answers
59 views

Too may query rows:50001

There are more than 40,000 records in my production database. Whenever I Search using these queries I get this error: Too may query rows:50001 SOSL query: String searchQuery = 'FIND \' '+...
0
votes
1answer
377 views

Dynamic sosl query not returning all events with search term in their subject

I seem to have an odd issue where for certain text phrases being searched with sosl, not all events being queried with the sosl search are returned that should be. For example: when FIND (meeting*) ...
1
vote
2answers
383 views

Is this SOSL search equivalent to the SOQL query?

Due to the need to apply Platform Encryption to the email address field on Contact and the fact that you can't use encrypted fields in a SOQL WHERE clause, I'm trying to convert the query to a SOSL ...
0
votes
1answer
124 views

SOSL not retrieving correct set of records

I need your inputs on the below issue: Query - FIND {1000} IN ALL FIELDS RETURNING Product2(Id,ProductCode,Universal_Picture_Code__c,Name,Country_Code__c,SAP_Sales_Org__c WHERE SAP_Sales_Org__c IN (...
-3
votes
1answer
288 views

SOSL not able to fetch records when called from Apex, even though database having matching records

I have been facing a unique kind of issue since the last 2 days, I am using SOSL Query in my Apex. It is working on a partial basis, i.e, returning records perfectly in some cases, while not returning ...

1 2
3
4 5
7