setAttributesToHighlight method
AttributesToHighlight
List of attributes to highlight.
Usage notes:
- Only string values can be highlighted. Numerics will be ignored.
- If set to null, all searchable attributes are highlighted (see
searchableAttributes
). - The special value
*
may be used to highlight all attributes.
Impact on the response:
- When highlighting is enabled, each hit in the response will contain an additional
_highlightResult object
(provided that at least one of its attributes is highlighted) with the following fields:value
(string): Markup text with occurrences highlighted. The tags used for highlighting are specified viahighlightPreTag
andhighlightPostTag
.matchLevel
(string, enum) = {none
|partial
|full
}: Indicates how well the attribute matched the search query.matchedWords
(array): List of words from the query that matched the object.fullyHighlighted
(boolean): Whether the entire attribute value is highlighted.
Source: Learn more
Implementation
AlgoliaQuery setAttributesToHighlight(List<String> value) {
assert(value.isNotEmpty, 'value can not be empty');
assert(!_parameters.containsKey('attributesToHighlight'));
return _copyWithParameters(
<String, dynamic>{'attributesToHighlight': value});
}