Search code examples
azure-cognitive-searchazure-ai

Azure Cognitive Search: Not always returning @search.answers but values with scores


Why is my query to an index in azure cognitive search not always returning a result in the field @search.answers?

I am sending the following hybrid query to my index:

  "search": "Why is Copenhagen a regional hub?",
  "vectorQueries": [
    {
      "kind": "text",
      "text": "Why is Copenhagen a regional hub?",
      "k": 5,
      "fields": "vector"
    }
  ],
  "queryType": "semantic",
  "semanticConfiguration": "my-config",
  "captions": "extractive",
  "answers": "extractive|count-3",
  "queryLanguage": "en-US"
} 

This query does not have the field @search.answers in the response filled which can be seen here: enter image description here

For most other search strings the required field is filled out with a text and highlight field.

According to the documentation an empty @search.answers field means that the search result is undetermined, which makes no sense because I get back some result values (even with high scores).

I am asking if anyone knows why this could happen. I wanted to retrieve the @search.answers because I have the feeling that this offers me the best search results.


Solution

  • The call looks right (“answers”: “extractive|count-3”).

    Answers are only returned when there is a definitive answer contained within the corpus of the documents retrieved. Only verbatim text from a document can appear as an answer. High search result scores but unpopulated “@search.answers” array suggest that the documents returned are relevant but may not contain a definitive and direct answer to the question. The @search.rerankerScore isn't visible in the screenshot so it is unclear how the ranker scored this result.

    The relevant questions are:

    1. Are you receiving answers for other queries?
    2. Specific to this query, is there a direct answer in the documents retrieved for this query?
    3. If yes to #2, is the field that contains that direct answer contained in a field that is prioritized within your semantic configuration?

    Return a semantic answer - Azure AI Search | Microsoft Learn