locked
Azure-Search Hit-Highlight Partial Match RRS feed

  • Question

  • 

    I have turned Hit Highlighting on and it is working well for entire word matches. But we append a wildcard character at the end of each word the user specifies and highlighting is not working on the partial matches. We are getting the results back, but the .Highlights object is null so no highlighting is available for partial matching.

    Here is how we configure the SearchParameters:

    var parameters = new SearchParameters
    {
        Filter = newFilter,
        QueryType = QueryType.Full,
        Top = recordsPerPage,
        Skip = skip,
        SearchMode = SearchMode.Any,
        IncludeTotalResultCount = true,
        HighlightFields = new List<string> { "RESULT" },
        HighlightPreTag = "<font style=\"color:blue; background-color:yellow;\">",
        HighlightPostTag = "</font>"
    };
    return parameters;
    
    response = indexClient.Documents.Search<SearchResultReturn>(query, parameters);
    

    Here is an example of our query string: ("the") the*^99.95

    The idea is we search for the exact string the user specified (multiple words) and then we do a wild-card search for each individual word specified.

    So for the above example we are getting all the results that contain "the" and "the*" but only the words "the" have the highlighting. "They", "There", etc do not have any highlighting even if "They" is the only matching entry in the result ("the" was not in the result).

    Again the query is bringing back the correct results, it's just the highlighting is not working for partial matches. Highlighting is working on full word matches, just not the partial matches.

    Is there some other setting I need to be able to highlight partial matches?

    Friday, April 13, 2018 6:27 PM

Answers