Is there any information on whether or not keyword highlighting is supported in Sitecore 9.0.1 using Azure Search?

It is an available feature in Solr as discussed here: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/using_solr_to_highlight_search_results but is not mentioned in the 'Limitations of Azure Search' section here: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/sitecore_azure_search_overview#_Limitations_of_Azure

If it is not available as part of Sitecore's Azure Search implementation, has anyone got any experience extending it to support this?

Many thanks

  • If you are satisfied with my answer, you can upvote it and accept it. Thanks Jul 10, 2018 at 19:36

2 Answers 2


I believe that keyword highlighting functionality is not supported by Azure Search provider used in your version of Sitecore. Maybe future versions will support that. Best would be to ask Sitecore Support.

It should be doable according to small note in this article but it's not implemented.

Also Azure SDK and Azure Search Properties with it's HighlightFields, HighlightPostTag and HighlightPreTag properties and Azure Search Result Model supports Highlights property similarly to Sitecore Solr implementation that you mentioned in your question.

Unfortunately in Sitecore implementation of Azure Search, I couldn't find any Highlights property implementation and therefore I believe this is for now not implemented:

enter image description here

Sitecore is not using any Azure SDK to do the search (in oppose to SolrNet library used for Solr). They have built their own implementation using HTTP calls so using Azure Search REST API.

Possible solutions:

1) Custom development of a new search provider using either Azure SDK or Azure REST API. This would be time consuming

2) Creating your own SearchResultsDeserializer class where you would have also Highlighting implemented:

enter code here

Problem is that you cannot just substitute OOTB class with your custom as there is no config entry for it. You would need to change lot's of other classes which are marked as internal. Tough solution to implement.

3) You have another option to contact Sitecore Support and ask them whether this is planned in roadmap or ask them to add this feature to feature request list for dev team. Therefore in this case you "just" have to wait for a next version or following one (if you don't have time constrains ;-) and Sitecore will add this functionality itself. I will give +1 to have this feature implemented.


We implemented our custom highlighting for Azure Search. We used StemmersNet from NuGet for words stemming (it supports stemming for 14 languages):

public static class SearchExtentions
    static char[] delimiters = { ' ', ',', ';', '.', ':', '-' };
    static IStemmer stemmer = new EnglishStemmer();

    public static string Highlight(this string text, string searchText, string beforeTerm = "<em style='color: blue'>", string afterTerm = "</em>")
        var terms = searchText.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
        foreach(var term in terms)
            var word = stemmer.Stem(term);
            var regex = new Regex(word, RegexOptions.IgnoreCase);
            if(regex.Matches(word).Count > 0)
                text = regex.Replace(text, beforeTerm + word + afterTerm);

        return text;

And used it for search results:

searchResult.Description = searchResult.Description.Highlight(searchPhrase);

Here you can see example of highlighting: Example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.