Class QueryAnswer

java.lang.Object
com.azure.search.documents.models.QueryAnswer

public final class QueryAnswer extends Object
Configuration for how semantic search returns answers to the search.
  • Constructor Details

    • QueryAnswer

      public QueryAnswer(QueryAnswerType answerType)
      Creates a new instance of QueryAnswer.
      Parameters:
      answerType - The type of answers to generate.
  • Method Details

    • getAnswerType

      public QueryAnswerType getAnswerType()
      Gets the type of answers to generate.
      Returns:
      The type of answers to generate.
    • getCount

      public Integer getCount()
      Gets the number of answers to generate.

      The number of answers to return is optional and will default to 1.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Returns:
      The number of answers to generate.
    • setCount

      public QueryAnswer setCount(Integer count)
      Sets the number of answers to generate.

      The number of answers to return is optional and will default to 1.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Parameters:
      count - The number of answers to generate.
      Returns:
      The QueryAnswer object itself.
    • getThreshold

      public Double getThreshold()
      Gets the confidence threshold an answer must match to be included as an answer to the query of answers.

      The threshold is optional and will default to 0.7.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Returns:
      The confidence threshold an answer must match to be included as an answer to the query of answers.
    • setThreshold

      public QueryAnswer setThreshold(Double threshold)
      Sets the confidence threshold an answer must match to be included as an answer to the query of answers.

      The threshold is optional and will default to 0.7.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Parameters:
      threshold - The confidence threshold an answer must match to be included as an answer to the query of answers.
      Returns:
      The QueryAnswer object itself.
    • getMaxCharLength

      public Integer getMaxCharLength()
      Gets the maximum character length of answers.

      The maximum character length of answers is optional.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Returns:
      The maximum character length of answers.
    • setMaxCharLength

      public QueryAnswer setMaxCharLength(Integer maxCharLength)
      Sets the maximum character length of answers.

      The maximum character length of answers is optional.

      The value only takes effect when getAnswerType() is QueryAnswerType.EXTRACTIVE.

      Parameters:
      maxCharLength - The maximum character length of answers.
      Returns:
      The QueryAnswer object itself.