Questions tagged [dynamic-sosl]

The tag has no usage guidance.

0
votes
1answer
74 views

SOSL No Result in Apex (Not Test Mode)

I want to query matching Accounts based NRIC Passport No AND Service Agent looking up to custom object Agent__c with a set of Ids (for bulkification) and i'm using: FIND '999999' IN ALL FIELDS ...
0
votes
1answer
27 views

SOSL Multiple Search Words

Trying to search multiple terms in SOSL in APEX. I tried this singular, of course works: [FIND 'searchOne' IN ALL FIELDS RETURNING ACCOUNT] But these don't work: [FIND 'searchOne' OR 'searchTwo' ......
0
votes
1answer
96 views

SOSL query with special characters

I am building a dynamic SOSL Query searchText = 'AB-C'; searchquery = 'FIND {'+ searchText + '} IN all FIELDS RETURNING Account( id, name, ownerid,website, CMFL__Oppty_Count__c WHERE '+ condition ...
4
votes
1answer
78 views

Does SOSL wildcard (*) work with space characters

I am currently trying to implement a sosl search query, so I can filter out non-letter characters for searching inside the salesforce database. Everything works as expected, however when I encounter a ...
0
votes
1answer
26 views

“Invalid USING clause” error when using list view in SOSL

I am trying to implement SOSL list view search and this is sort of follow up question. I am trying this query in from Apex and getting error in title: System.debug( Search.find('FIND \'foo\' ...
0
votes
1answer
142 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 ...
2
votes
1answer
50 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(...
0
votes
1answer
398 views

How to implement Dynamic SOSL with 'Contains' keyword

This is an embedded VF page on the Contact detail page. I have this SOSL query to display all the related contact records on every Contact detail page. But for few contacts, email field(of Parent ...
1
vote
2answers
218 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
129 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 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 ...
0
votes
1answer
59 views

expecting a right parentheses SOSL

I am creating a dynamic SOSL which finally executed as below when I print in debug: FIND 'gar,ont2' RETURNING Contact ( Name, FirstName, LastName WHERE (Preferred_First_Name__c like '%gar%' OR ...
0
votes
1answer
203 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*) ...
2
votes
0answers
123 views

SOSL query on ContentDocument [closed]

I have a requirement to search within files. To get that working, I have a SOSL query on ContentVersion. It seemed to work as expected when I tested as myself, however... I myself seem to get the ...
0
votes
1answer
324 views

Dynamic SOSL SearchQuery with AND Clause for Contact Firstname and Lastname

If i am trying to make a SOSL Search Query dynamic where Firstname and Lastname will be coming from remote parameter dynamically. Attached code sample is not working - But if i make the SOSL Query ...
0
votes
1answer
59 views

Performance issue for searchable 500+ fields

I haven't work on something like this before but what are the performance implication whether using SOQL or SOSL 500 fields+ (fields will be added dynamically as the application grows) and having 800K ...
0
votes
1answer
509 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.
0
votes
1answer
412 views

From Parent ID, dynamically derive child's lookup field name/token

I'm trying to save a new record dynamically, but I'm having a problem with a lookup field. For instance, I'm able to get the parent object with the id. Id relatedID = '<someId>'; SObjectType ...
8
votes
4answers
13k 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 ...
8
votes
1answer
745 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*' ...
1
vote
3answers
227 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
1answer
175 views

Showing matching keyword sentences from SOSL/SOQL results

We have a requirement to search in large text area field (for e.g. Description). We are using SOSL for the same. While showing results on the VF page we want to only few sentence from Description ...
3
votes
2answers
4k views

How do I create a Dynamic SOSL Query

I need to allow a User to narrow their article search by ArticleType when desired My current Controller handles the search input just fine and can also accept a search via a URL parameter. Where I ...
4
votes
1answer
1k views

SOSL query returns only 250 records even if there are more than 2000+ records present

I have two queries List<sobject> soslRecords1 = Search.query('FIND {I need help res*} in all fields returning Incident__c (id) where ID IN:rec_ids')[0]; List<sobject> ...
3
votes
1answer
669 views

Interpreting wildcards (eg, * and &) in SOSL queries through the API. Escape or not?

I have a search feature that is implemented with the AJAX toolkit to use SOSL. var results = sforce.connection.search("FIND {" + sanitize(...) + "} IN NAME FIELDS RETURNING ..."); The sanitize(...) ...
3
votes
5answers
1k views

Function to properly escape dynamic SOSL input

I have a page that allows users to specify a search term that then gets put into a SOSL Query. Obviously I'm escaping single quotes to prevent injection, but certain input still cause my code to ...
5
votes
1answer
2k views

Escaping reserverved characters in SOSL queries

Escaping reserverved characters with backslash as described in Force documentation (http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_find.htm) give unexpected ...
7
votes
4answers
5k views

How do I SOSL across objects, matching all records with FIND clause?

To all the expert SOSL gurus lurking out there, I thought this will be an interesting one: I have some SObjects of different types and I want to return their Name values in a single query. In ...