Compartilhar via


QueryAnswer Class

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

public final class QueryAnswer

Configuration for how semantic search returns answers to the search.

Constructor Summary

Constructor Description
QueryAnswer(QueryAnswerType answerType)

Creates a new instance of QueryAnswer.

Method Summary

Modifier and Type Method and Description
QueryAnswerType getAnswerType()

Gets the type of answers to generate.

Integer getCount()

Gets the number of answers to generate.

Double getThreshold()

Gets the confidence threshold an answer must match to be included as an answer to the query of answers.

QueryAnswer setCount(Integer count)

Sets the number of answers to generate.

QueryAnswer setThreshold(Double threshold)

Sets the confidence threshold an answer must match to be included as an answer to the query of answers.

Methods inherited from java.lang.Object

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 EXTRACTIVE.

Returns:

The number of answers to generate.

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 EXTRACTIVE.

Returns:

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

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 EXTRACTIVE.

Parameters:

count - The number of answers to generate.

Returns:

The QueryAnswer object itself.

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 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.

Applies to