你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

SemanticSearchOptions Class

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

public final class SemanticSearchOptions

Parameters for performing vector searches.

Constructor Summary

Constructor Description
SemanticSearchOptions()

Creates a new instance of SemanticSearchOptions.

Method Summary

Modifier and Type Method and Description
SemanticErrorMode getErrorMode()

Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, or to return partial results.

Duration getMaxWaitDuration()

Get the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails.

QueryAnswer getQueryAnswer()

Get the answers property: This parameter is only valid if the query type is 'semantic'.

QueryCaption getQueryCaption()

Get the query caption property: This parameter is only valid if the query type is 'semantic'.

String getSemanticConfigurationName()

Get the semanticConfigurationName property: The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, highlights, and answers.

String getSemanticQuery()

Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and semantic answers.

SemanticSearchOptions setErrorMode(SemanticErrorMode errorMode)

Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, or to return partial results.

SemanticSearchOptions setMaxWaitDuration(Duration maxWaitDuration)

Set the semanticMaxWaitDuration property: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails.

SemanticSearchOptions setQueryAnswer(QueryAnswer queryAnswer)

Set the answers property: This parameter is only valid if the query type is 'semantic'.

SemanticSearchOptions setQueryCaption(QueryCaption queryCaption)

Set the query caption property: This parameter is only valid if the query type is 'semantic'.

SemanticSearchOptions setSemanticConfigurationName(String semanticConfigurationName)

Set the semanticConfigurationName property: The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, highlights, and answers.

SemanticSearchOptions setSemanticQuery(String semanticQuery)

Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and semantic answers.

Methods inherited from java.lang.Object

Constructor Details

SemanticSearchOptions

public SemanticSearchOptions()

Creates a new instance of SemanticSearchOptions.

Method Details

getErrorMode

public SemanticErrorMode getErrorMode()

Get the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, or to return partial results.

Returns:

the semanticErrorHandling value.

getMaxWaitDuration

public Duration getMaxWaitDuration()

Get the semanticMaxWaitInMilliseconds property: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails.

Returns:

the semanticMaxWaitDuration value.

getQueryAnswer

public QueryAnswer getQueryAnswer()

Get the answers property: This parameter is only valid if the query type is 'semantic'. If set, the query returns answers extracted from key passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe character '|' followed by the 'count-' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1. The confidence threshold can be configured by appending the pipe character '|' followed by the 'threshold-' option after the answers parameter value, such as 'extractive|threshold-0.9'. Default threshold is 0.7.

Returns:

the answers value.

getQueryCaption

public QueryCaption getQueryCaption()

Get the query caption property: This parameter is only valid if the query type is 'semantic'. If set, the query returns captions extracted from key passages in the highest ranked documents. When Captions is set to 'extractive', highlighting is enabled by default, and can be configured by appending the pipe character '|' followed by the 'highlight-<true/false>' option, such as 'extractive|highlight-true'. Defaults to 'None'.

Returns:

the query caption value.

getSemanticConfigurationName

public String getSemanticConfigurationName()

Get the semanticConfigurationName property: The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, highlights, and answers.

Returns:

the semanticConfigurationName value.

getSemanticQuery

public String getSemanticQuery()

Get the semanticQuery property: Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different queries between the base retrieval and ranking phase, and the L2 semantic phase.

Returns:

the semanticQuery value.

setErrorMode

public SemanticSearchOptions setErrorMode(SemanticErrorMode errorMode)

Set the semanticErrorHandling property: Allows the user to choose whether a semantic call should fail completely, or to return partial results.

Parameters:

errorMode - the semanticErrorHandling value to set.

Returns:

the SemanticSearchOptions object itself.

setMaxWaitDuration

public SemanticSearchOptions setMaxWaitDuration(Duration maxWaitDuration)

Set the semanticMaxWaitDuration property: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails.

Parameters:

maxWaitDuration - the semanticMaxWaitInMilliseconds value to set.

Returns:

the SemanticSearchOptions object itself.

setQueryAnswer

public SemanticSearchOptions setQueryAnswer(QueryAnswer queryAnswer)

Set the answers property: This parameter is only valid if the query type is 'semantic'. If set, the query returns answers extracted from key passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe character '|' followed by the 'count-' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1. The confidence threshold can be configured by appending the pipe character '|' followed by the 'threshold-' option after the answers parameter value, such as 'extractive|threshold-0.9'. Default threshold is 0.7.

Parameters:

queryAnswer - the answers value to set.

Returns:

the SemanticSearchOptions object itself.

setQueryCaption

public SemanticSearchOptions setQueryCaption(QueryCaption queryCaption)

Set the query caption property: This parameter is only valid if the query type is 'semantic'. If set, the query returns captions extracted from key passages in the highest ranked documents. When Captions is set to 'extractive', highlighting is enabled by default, and can be configured by appending the pipe character '|' followed by the 'highlight-<true/false>' option, such as 'extractive|highlight-true'. Defaults to 'None'.

Parameters:

queryCaption - the query caption value to set.

Returns:

the SemanticSearchOptions object itself.

setSemanticConfigurationName

public SemanticSearchOptions setSemanticConfigurationName(String semanticConfigurationName)

Set the semanticConfigurationName property: The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, highlights, and answers.

Parameters:

semanticConfigurationName - the semanticConfigurationName value to set.

Returns:

the SemanticSearchOptions object itself.

setSemanticQuery

public SemanticSearchOptions setSemanticQuery(String semanticQuery)

Set the semanticQuery property: Allows setting a separate search query that will be solely used for semantic reranking, semantic captions and semantic answers. Is useful for scenarios where there is a need to use different queries between the base retrieval and ranking phase, and the L2 semantic phase.

Parameters:

semanticQuery - the semanticQuery value to set.

Returns:

the SemanticSearchOptions object itself.

Applies to