SOSL Flashcards

Salesforce Object Search Language (34 cards)

1
Q

What does SOSL stand for?

A

Salesforce Object Search Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When is SOSL used?

A

SOSL can be used when the object or field where the searched data resides in is not known.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What three field types does SOSL allow searching on?

A

SOSL allows searching text, email, and phone fields across multiple objects simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The ______ and _______ to be searched and fields to be returned can be specified.

A

objects, fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What clause is used to specify the word or phrase to search for?

A

The FIND clause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The optional _________ clause can be used to specify the information to be returned.

A

RETURNING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What three clauses can be used for specific text searches?

A

In, Where, Limit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the return type of a SOSL query?

A

Each SOSL query returns a list of lists of sObjects. A variable of type List<List<SObject>>can be used to store the results of a SOSL query in Apex.</SObject>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Example SOSL Query:

A

FIND {test} RETURNING Account (Id), Contact, Opportunity LIMIT 60

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If we want to include fields in the search what clause would we use?

A

The IN Clause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The types of text fields to search for using SOSL can be specified through the optional __________ clause.

A

IN SearchGroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When using the SearchGroup phrase ________. All searchable fields are searched. It is the default setting if the IN clause is not specified.

A

ALL FIELDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When using the SearchGroup phrase ________. Only email fields are searched.

A

EMAIL FIELDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When using the SearchGroup phrase ________. Only name fields on standard and custom objects are searched. Some additional fields such as ‘Website’ and ‘Site’ on Account and ‘Company’ on Lead are also searched.

A

NAME FIELDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When using the SearchGroup phrase ________. Only phone number fields are searched.

A

PHONE FIELDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When using the SearchGroup phrase ________. Only valid records as listed in the sidebar drop-down list (Salesforce Classic only) are searched.

A

SIDEBAR FIELDS

17
Q

Example using SearchGroup Phrasing:

A

FIND {Marcus} IN NAME FIELDS

18
Q

The ______ clause is used to search and only return records that match a specified criteria.

19
Q

WHERE Clause Example:

A

FIND {test} RETURNING Account (Id WHERE Rating = ‘Hot’)

20
Q

The optional _____ clause can be added to a query to specify the maximum number of rows that are returned in a search result.

21
Q

What is the max value that can be set in a LIMIT clause?

A

The maximum value that can be set in a LIMIT clause is 2,000. The default limit is also 2,000

22
Q

Can a LIMIT clause be applied to individual objects in a single SOSL query?

23
Q

What happens when a limit is set on the entire query?

A

The results are evenly distributed among the objects returned.

24
Q

SOSL Limit Example:

A

FIND {test} RETURNING Account (Id LIMIT10)

25
What does using Order By allow us to do in a SOSL query?
It allows us to specify the order of the results returned.
26
Null records can be ordered at the beginning(default) or end by using ______________________
NULLS FIRST or NULLS LAST
27
How can results be ordered in ascending or descending order? What is the Default order?
Asc/Desc, Ascending
28
SOSL Order By Example:
FIND {test} RETURNING Account (Id, Name, Rating, Type ORDERBY Id DESC)
29
What are wildcard characters used for?
Wildcard characters can be used to search values that match text patterns
30
__________ can be used to match only one character in the middle or end of search term.
Question marks(?)
31
____________ can be used to match zero or more characters in the middle or end of search term.
Asterisks (*)
32
SOSL Wildcard Example:
The query FIND {Mi*}, will return results like “Mike” and “Michael OR FIND {United*} IN ALL FIELDS RETURNING Account(Id, Name), Contact(ID, Name)
33
If we use SOSL to return a list of accounts, how can you retrieve an item from the list of a specific index value?
[0] where 0 is the specific index you are looking for.
34
If we want to provide our SOSL query as a string and then supply that to a method to execute the SOSL in the string, what method would we use?
Use the query() method of the Search class and supply the string like so: List> results = Search.query(q); Where q is a string that represents our SOSL query.