In Azure Cognitive Search query, how do I know which property of document is search hit?

Manish Rathore 0 Reputation points
2023-09-26T20:56:02.37+00:00

Hello,

This is regarding querying azure cognitive search service.

Question: If I have Student document that has FirstName, LastName, Address and CollegeName fields. When I fire a query and query returns list of documents, how would I know which field of the document is the search hit?

Ex. If I search "John" and following is returned in search, how would I know if field FirstName is search hit?
Student 1:
{

FirstName:"John",
LastName:"Smith",
Address:"901 PeachTree Street"
CollegeName: "UT - Austin"

}

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,354 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 25,111 Reputation points Microsoft Employee Moderator
    2023-09-27T09:23:57.34+00:00

    @Manish Rathore Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    To achieve, your requirement you can use highlighters technique in cognitive search which is used to text formatting (such as bold or yellow highlights) applied to matching terms in a result, making it easy to spot the match.

    Notice that highlighting can be applied to individual terms. There's no highlight capability for the contents of an entire field. If you want to highlight over a phrase, you'll have to provide the matching terms (or phrase) in a quote-enclosed query string.

    Highlighting supports Keyword search and Phrase search. You can refer to these documentations on how to specify highlighting in your request explaining with sample response and also about the query parameters in cognitive search.

    Feel free to reach back to me if you have any further questions on this.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.