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
7
votes
1answer
2k views

SOSL and “ends with” wildcard

I am trying to implement a SOSL search function that uses an "ends with" wildcard, like *searchString in SOQL. No luck! I know about this limitation of SOSL Asterisks match zero or more characters ...
3
votes
0answers
595 views

How can I access Record Tags and/or Content tags via Apex & SOQL & SOSL

I have a requirement to produce a unified search across Salesforce records using tags and documents in Content. Both records and Content items may have received the same tag from a user and my ...
3
votes
1answer
911 views

SOSL - Return correct related record type

I'm having an issue with the type field on related records from an SOSL search. In our organization, Leads can be owned by either a User or a Group/Queue and Accounts can only be owned by Users. ...
6
votes
2answers
543 views

Check if a .txt file of IDs all exist in Salesforce

I receive a .txt files of type ID, e.g. 003U000000PL9LN, 001U000000PL9LM, a1fU000000PL9LO. I need to check if these IDs correspond to valid objects within Salesforce. I have a List of IDs in Apex. ...
1
vote
3answers
2k views

SOQL query by data type

Is it possible to query fields by datatype? I need to query all email fields from different objects. Email field names are different on each object and not known in advance. So I am trying to query by ...
4
votes
1answer
2k views

How to order SOSL results by relevance

How can I order the results of a SOSL query by relevance, meaning the result with the most matches of my OR term first? I have an Apex class that uses SOSL to find potential duplicates for a new bug ...
6
votes
1answer
7k views

How to Search a text in all fields in all objects and return all values?

Can I find a string from all fields from all custom and standard objects and return the data (all field data) of all the records that matches for all the fields of those objects?? Also is there an ...
2
votes
2answers
3k views

Using SOSL to find all related records

I am trying to write a query to find all child records of a parent record. I know I can do this with a SOQL on each child object, but I want to do something slicker. For example, my parent object is ...
3
votes
1answer
1k views

Knowledge - How to filter SOSL results by a SOQL and save on API calls?

My organization frequently does work with SalesForce knowledge. And the recommended way to search Knowledge is either by the exact type of the article that you created in your instance or by the ...
8
votes
1answer
3k views

Search formula fields using SOSL

Im trying to build a custom job board search on visualforce. I have a positions object which has a relationship has a master detail field to account. I'd like the search to return positions when you ...
7
votes
3answers
729 views

How to search for a long list of arguments

We have reports to search all cases that contain certain serial numbers (strings) in a custom text area field that can contain a comma-separated list of serial numbers. Additionally, serial numbers ...
3
votes
2answers
618 views

Unable to Access Page

I get the following error when I run the following class: public with sharing class CaseUpdatePriorityEmailBodyMisc { public void updateCaseWhenDiscriptionFindBadWord(){ List<Case> ...
6
votes
3answers
2k views

What is the maximum number of rows that SOQL and SOSL can “scan”?

It's quite clear from the governor limits documentation how many records can be returned, and the docs do mention that SOQL in a trigger will scan a maximum of 100k records. So my questions are: For ...
5
votes
1answer
491 views

What is the max length of a SOSL search expression?

My SOSL query with an extremely long search expression failed with System.UnexpectedException: Search Term exceeded max length Searching the Documentation I could not find anything about a max ...
18
votes
3answers
2k views

Why is SOSL in Test not working?

I have a Custom Object that contains a long text area with 32.000 chars full of comma-separated Ids. I need to find all such records that contain one or more ids. I tried to implement this in this ...
3
votes
1answer
540 views

Custom indexes in SOSL

We are planning to use SOSL to search for a phone number on all phone fields in the Account object, and in our custom Address object. I know that when we use SOQL, performance can be improved by ...
9
votes
1answer
2k views

How long does it take for Salesforce to build the SOSL index?

After adding new data to Salesforce, the records do not show up immediately in SOSL queries or the Salesforce search interface. How long does it take for new information to be indexed? I'm looking ...
8
votes
2answers
1k views

SOSL : FIND '“com”' returning more records than FIND '“com” or “net”'

When trying to search a string using SOSL, it behaves differently for one search parameter vs two search parameters with logical operator. Search String 1 : FIND '"com"' => No of Records Returned : ...
38
votes
3answers
44k views

SOQL vs SOSL - Which one to use and when?

What arguments can be made to use SOQL or SOSL? When would you use one over the other? What is the main difference?
13
votes
3answers
8k views

Is there any way to filter a SOQL or SOSL query on the Id field?

I've tried a number of ways including: SELECT Id, Name FROM Account WHERE Id LIKE '0013%' and FIND { 0013 } IN ALL FIELDS RETURNING Account (Id, Name) and all I receive is the same ...
2
votes
2answers
1k views

How to build a Stackexchange-like search while typing in Salesforce

We have an internal defect tracker in Salesforce which should have much more of the charming features of Stackexchange. One feature that I love the most is the live-search for duplicates while ...
12
votes
1answer
7k views

Why does SOSL return a List of a List of sObjects in Apex?

When I use SOSL in Apex (search.query();) the return type is List<List<sObject>>, but I've never run across a case in which there is more than one list returned. For example, this: ...
7
votes
1answer
1k views

Implementing a Keyword Search

A more detailed explanation follows, but the core of my question is: what are best practices for implementing a general keyword search in SOQL/Apex? In an app that I'm building, we're using a data ...
7
votes
1answer
611 views

Relationships in SOSL

Can I use relationships in SOSL? Example: Find all first names that start with 'Roc' within Position__c FIND \'Roc*\' IN ALL FIELDS RETURNING Position__c(Id, Contact__r.FirstName WHERE Title__c = '...
5
votes
2answers
1k views

Apex SOSL Paging Implementations

How might one implement SOSL paging, i.e. get the next 200 results, in Apex?