🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / restrictHighlightAndSnippetArrays

restrictHighlightAndSnippetArrays

Type: boolean
Engine default: false
Parameter syntax
'restrictHighlightAndSnippetArrays' => true|false

Can be used in these methods:

About this parameter

Restrict highlighting and snippeting to items that matched the query.

Impact on the response:

  • When false, all items are highlighted/snippeted

  • When true, only items that matched at least partially are highlighted/snippeted

Examples

Set restrictHighlightAndSnippetArrays default value

1
2
3
$index->setSettings([
  'restrictHighlightAndSnippetArrays' => true
]);
1
2
3
$results = $index->search('query', [
  'restrictHighlightAndSnippetArrays' => false
]);
Did you find this page helpful?