SearchApiResult Apex Class
SearchApiResult Apex Class
Coveo for Salesforce 3.38 (August 2019)
Represents a Coveo Search Result.
You should also consult the:
The following fields constitute a Coveo SearchAPI result:
-
title
(string): the item title. -
uri
(string): the item URI. -
printableUri
(string): the human-readable item URI. -
clickUri
(string): the hyperlinkable item URI. -
uniqueId
(string): the unique item identifier. -
excerpt
(string): the contextual excerpt generated for the item. -
hasHtmlVersion
(Boolean): whether the index contains an HTML version of the item. -
score
(integer): the total ranking score computed for the item. -
isTopResult
(Boolean): whether the item was included in the results because it’s a Top Result in the index configuration. -
isRecommendation
(Boolean): whether the item score was boosted as a Coveo ML recommendation. -
rankingModifier
(string): if applicable, represents the type of ranking modification that was applied to this result. -
map<String, Object> raw
: the raw response.
key param
The key to look for in the raw field result.
Object myProperty = mySearchApiResponse.results[0].getRawProperty('bar');
If you want to have a typed field value, use the below methods to get your property in the expected type.
getRawProperty(String fieldName)
Attempts to return an untyped property from the result’s raw field. Returns null
if the key doesn’t exist.
getRawPropertyAsDateTime
Attempts to return a DateTime
property from a result’s raw field. Returns null
if the key doesn’t exist.
getRawPropertyAsString
Attempts to return a String
property from the result’s raw field. Returns an empty string if the key doesn’t exist.
getRawPropertyAsBoolean
Attempts to return a Boolean
property from the result’s raw field. Returns false
if the key doesn’t exist.
getRawPropertyAsInteger
Attempts to return an Integer
property from the result’s raw field. Returns 0
if the key doesn’t exist.
getRawPropertyAsDouble
Attempts to return a Double
property from the result’s raw field. Returns 0.0
if the key doesn’t exist.