Newer Version Available
Search Class
Namespace
Search Methods
answer(q)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchAnswer answer(String q)
Parameters
- q
- Type: String
- Natural language query to search for in the org.
Return Value
Type: ConnectApi.SearchAnswer
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
answer(q, objectApiName)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchAnswer answer(String q, String objectApiName)
Parameters
Return Value
Type: ConnectApi.SearchAnswer
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
answer(q, objectApiName, displayFields)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchAnswer answer(String q, String objectApiName, List<String> displayFields)
Parameters
Return Value
Type: ConnectApi.SearchAnswer
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
findAndGroup(q)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchResultGroups findAndGroup(String q)
Parameters
- q
- Type: String
- One or more keywords to search for in the org.
Return Value
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
findAndGroup(q, configurationName)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchResultGroups findAndGroup(String q, String configurationName)
Parameters
Return Value
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
findAndGroup(q, configurationName, highlights)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.SearchResultGroups findAndGroup(String q, String configurationName, Boolean highlights)
Parameters
Return Value
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
find(objectApiName, request)
API Version
63.0
Available to Guest Users
63.0
Requires Chatter
No
Signature
public static ConnectApi.ScopedSearchResults find(String objectApiName, ConnectApi.SearchRequest request)
Parameters
- objectApiName
- Type: String
- API name of the object to search.
- request
- Type: ConnectApi.SearchRequest
- ConnectApi.SearchRequest input class with more information about what and how to search.
Return Value
Usage
To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.
Search Test Methods
For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.
setTestAnswer(q, result)
API Version
63.0
Signature
public static Void setTestAnswer(String q, ConnectApi.SearchAnswer result)
Parameters
- q
- Type: String
- Natural language query to search for in the org.
- result
- Type: ConnectApi.SearchAnswer
- Object containing test data.
Return Value
Type: Void
setTestAnswer(q, objectApiName, result)
API Version
63.0
Signature
public static Void setTestAnswer(String q, String objectApiName, ConnectApi.SearchAnswer result)
Parameters
- q
- Type: String
- Natural language query to search for in the org.
- objectApiName
- Type: String
- API name of the object.
- result
- Type: ConnectApi.SearchAnswer
- Object containing test data.
Return Value
Type: Void
setTestAnswer(q, objectApiName, displayFields, result)
API Version
62.0
Signature
public static Void setTestAnswer(String q, String objectApiName, List<String> displayFields, ConnectApi.SearchAnswer result)
Parameters
- q
- Type: String
- Natural language query to search for in the org.
- objectApiName
- Type: String
- API name of the object.
- displayFields
- Type: List<String>
- List of fields to display and return in the search results. By default, the fields displayed are defined by the search layout.
- result
- Type: ConnectApi.SearchAnswer
- Object containing test data.
Return Value
Type: Void
setTestFindAndGroup(q, result)
API Version
63.0
Signature
public static Void setTestFindAndGroup(String q, ConnectApi.SearchResultGroups result)
Parameters
- q
- Type: String
- One or more keywords to search for in the org.
- result
- Type: ConnectApi.SearchResultGroups
- Object containing test data.
Return Value
Type: Void
setTestFindAndGroup(q, configurationName, result)
API Version
63.0
Signature
public static Void setTestFindAndGroup(String q, String configurationName, ConnectApi.SearchResultGroups result)
Parameters
- q
- Type: String
- One or more keywords to search for in the org.
- configurationName
- Type: String
- Search configuration to apply.
- result
- Type: ConnectApi.SearchResultGroups
- Object containing test data.
Return Value
Type: Void
setTestFindAndGroup(q, configurationName, highlights, result)
API Version
63.0
Signature
public static Void setTestFindAndGroup(String q, String configurationName, Boolean highlights, ConnectApi.SearchResultGroups result)
Parameters
- q
- Type: String
- One or more keywords to search for in the org.
- configurationName
- Type: String
- Search configuration to apply.
- highlights
- Type: Boolean
- Specifies whether search generates a text highlight (true) or not (false).
- result
- Type: ConnectApi.SearchResultGroups
- Object containing test data.
Return Value
Type: Void
setTestFind(objectApiName, request, result)
API Version
63.0
Signature
public static Void setTestFind(String objectApiName, ConnectApi.SearchRequest request, ConnectApi.ScopedSearchResults result)
Parameters
- objectApiName
- Type: String
- API name of the object to search.
- request
- Type: ConnectApi.SearchRequest
- ConnectApi.SearchRequest input class with more information about what and how to search.
- result
- Type: ConnectApi.ScopedSearchResults
- Object containing test data.
Return Value
Type: Void