Search highlighting - Search highlighting - Search highlighting allows you to see your search term in context within search results. - Alfresco - Alfresco Search Enterprise - Alfresco/Alfresco-Search-Enterprise/4.2/Alfresco-Search-Enterprise/Using/Search-query-syntax/Search-highlighting - 4.2 - 4.2

Alfresco Search Enterprise

Platform
Alfresco
Product
Alfresco Search Enterprise
Release
4.2
License
ft:lastPublication
2025-10-21T22:01:30.506000
ft:locale
en-US

Search highlighting allows you to see your search term in context within search results.

In the query, you can set the following properties:

Property Description
snippetCount The maximum number of distinct highlight snippets to return for each highlight field.
Note: The default number of snippets is 5.
fragmentSize The character length of each snippet.
prefix The string used to mark the start of a highlight in a fragment.
Note: By default, the matched term is highlighted by surrounded by an em tag.
postfix The string used to mark the end of a highlight in a fragment.
Note: By default, the matched term is highlighted by surrounded by an em tag.

Following is an example query including search highlighting with the properties set:

{
    "query": {
        "query": "cm:content:Content Service",
        "language": "afts"
    },
    "highlight": {
        "snippetCount": 4,
        "fragmentSize": 70,
        "fields": [
            {
                "field": "cm:content"
            }
        ]
    }
}

The query returns the following output with the match surrounded by the em tag:

"snippets": [
    "Alfresco <em>Content</em> Accelerator (ACA) provides a no-code, streamlined",
    " on Alfresco <em>Content</em> <em>Services</em> (ACS).\nACA enables customers to view",
    ", search, and manage their <em>content</em> from a friendly and simple modern front",
    " that the customer, or our <em>services</em> team can tweak to the customers unique needs"
]

For more information, see the Term highlighting search section in the Alfresco Content Services documentation.