QueryResult Class

  • java.lang.Object
    • com.microsoft.bot.ai.qna.models.QueryResult

public class QueryResult

Represents an individual result from a knowledge base query.

Constructor Summary

Constructor Description
QueryResult()

Method Summary

Modifier and Type Method and Description
java.lang.String getAnswer()

Gets the answer text.

QnAResponseContext getContext()

Gets context for multi-turn responses.

java.lang.Integer getId()

Gets the index of the answer in the knowledge base.

Metadata[] getMetadata()

Gets metadata that is associated with the answer.

java.lang.String[] getQuestions()

Gets the list of questions indexed in the QnA Service for the given answer.

java.lang.Float getScore()

Gets the answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

java.lang.String getSource()

Gets the source from which the QnA was extracted.

void setAnswer(String withAnswer)

Sets the answer text.

void setContext(QnAResponseContext withContext)

Sets context for multi-turn responses.

void setId(Integer withId)

Sets the index of the answer in the knowledge base.

void setMetadata(Metadata[] withMetadata)

Sets metadata that is associated with the answer.

void setQuestions(String[] withQuestions)

Sets the list of questions indexed in the QnA Service for the given answer.

void setScore(Float withScore)

Sets the answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

void setSource(String withSource)

Sets the source from which the QnA was extracted.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

QueryResult

public QueryResult()

Method Details

getAnswer

public String getAnswer()

Gets the answer text.

Returns:

The answer text.

getContext

public QnAResponseContext getContext()

Gets context for multi-turn responses.

Returns:

The context from which the QnA was extracted.

getId

public Integer getId()

Gets the index of the answer in the knowledge base. V3 uses 'qnaId', V4 uses 'id'.

Returns:

The index of the answer in the knowledge base. V3 uses 'qnaId', V4 uses 'id'.

getMetadata

public Metadata[] getMetadata()

Gets metadata that is associated with the answer.

Returns:

Metadata that is associated with the answer.

getQuestions

public String[] getQuestions()

Gets the list of questions indexed in the QnA Service for the given answer.

Returns:

The list of questions indexed in the QnA Service for the given answer.

getScore

public Float getScore()

Gets the answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

Returns:

The answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

getSource

public String getSource()

Gets the source from which the QnA was extracted.

Returns:

The source from which the QnA was extracted.

setAnswer

public void setAnswer(String withAnswer)

Sets the answer text.

Parameters:

withAnswer - The answer text.

setContext

public void setContext(QnAResponseContext withContext)

Sets context for multi-turn responses.

Parameters:

withContext - The context from which the QnA was extracted.

setId

public void setId(Integer withId)

Sets the index of the answer in the knowledge base. V3 uses 'qnaId', V4 uses 'id'.

Parameters:

withId - The index of the answer in the knowledge base. V3 uses 'qnaId', V4 uses 'id'.

setMetadata

public void setMetadata(Metadata[] withMetadata)

Sets metadata that is associated with the answer.

Parameters:

withMetadata - Metadata that is associated with the answer.

setQuestions

public void setQuestions(String[] withQuestions)

Sets the list of questions indexed in the QnA Service for the given answer.

Parameters:

withQuestions - The list of questions indexed in the QnA Service for the given answer.

setScore

public void setScore(Float withScore)

Sets the answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

Parameters:

withScore - The answer's score, from 0.0 (least confidence) to 1.0 (greatest confidence).

setSource

public void setSource(String withSource)

Sets the source from which the QnA was extracted.

Parameters:

withSource - The source from which the QnA was extracted.

Applies to