Class SearchOptions
java.lang.Object
com.azure.search.documents.models.SearchOptions
Additional parameters for searchGet operation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the answers property: This parameter is only valid if the query type is 'semantic'.Get the answers count property: This parameter is only valid if the query type is 'semantic'.Get the facets property: The list of facet expressions to apply to the search query.Get the filter property: The OData $filter expression to apply to the search query.Get the highlightFields property: The list of field names to use for hit highlights.Get the highlightPostTag property: A string tag that is appended to hit highlights.Get the highlightPreTag property: A string tag that is prepended to hit highlights.Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success.Get the orderBy property: The list of OData $orderby expressions by which to sort the results.Get the query caption property: This parameter is only valid if the query type is 'semantic'.Get the query caption highlight property: This parameter is only valid if the query type is 'semantic'.Get the queryLanguage property: The language of the query.Get the queryType property: A value that specifies the syntax of the search query.Get the scoringParameters property: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values.Get the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.Get the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency.Get the searchFields property: The list of field names to which to scope the full-text search.Get the searchMode property: A value that specifies whether any or all of the search terms must be matched in order to count the document as a match.Get the select property: The list of fields to retrieve.Get the semanticConfigurationName property: The name of the semantic configuration that lists which fields should be used for semantic ranking, captions, highlights, and answers.Get the semanticFields property: The list of field names used for semantic search.Get the sessionId property: A value to be used to create a sticky session, which can help to get more consistent results.getSkip()
Get the skip property: The number of search results to skip.Get the speller property: Improve search recall by spell-correcting individual search query terms.getTop()
Get the top property: The number of search results to retrieve.Get the includeTotalCount property: A value that specifies whether to fetch the total count of results.setAnswers
(QueryAnswerType answers) Set the answers property: This parameter is only valid if the query type is 'semantic'.setAnswersCount
(Integer answersCount) Set the answers count property: This parameter is only valid if the query type is 'semantic'.Set the facets property: The list of facet expressions to apply to the search query.Set the filter property: The OData $filter expression to apply to the search query.setHighlightFields
(String... highlightFields) Set the highlightFields property: The list of field names to use for hit highlights.setHighlightPostTag
(String highlightPostTag) Set the highlightPostTag property: A string tag that is appended to hit highlights.setHighlightPreTag
(String highlightPreTag) Set the highlightPreTag property: A string tag that is prepended to hit highlights.setIncludeTotalCount
(Boolean includeTotalCount) Set the includeTotalCount property: A value that specifies whether to fetch the total count of results.setMinimumCoverage
(Double minimumCoverage) Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success.setOrderBy
(String... orderBy) Set the orderBy property: The list of OData $orderby expressions by which to sort the results.setQueryCaption
(QueryCaptionType queryCaption) Set the query caption property: This parameter is only valid if the query type is 'semantic'.setQueryCaptionHighlightEnabled
(Boolean queryCaptionHighlightEnabled) Set the query caption highlight property: This parameter is only valid if the query type is 'semantic'.setQueryLanguage
(QueryLanguage queryLanguage) Set the queryLanguage property: The language of the query.setQueryType
(QueryType queryType) Set the queryType property: A value that specifies the syntax of the search query.setScoringParameters
(ScoringParameter... scoringParameters) Set the scoringParameters property: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values.setScoringProfile
(String scoringProfile) Set the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.setScoringStatistics
(ScoringStatistics scoringStatistics) Set the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency.setSearchFields
(String... searchFields) Set the searchFields property: The list of field names to which to scope the full-text search.setSearchMode
(SearchMode searchMode) Set the searchMode property: A value that specifies whether any or all of the search terms must be matched in order to count the document as a match.Set the select property: The list of fields to retrieve.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.setSemanticFields
(List<String> semanticFields) Set the semanticFields property: The list of field names used for semantic search.setSessionId
(String sessionId) Set the sessionId property: A value to be used to create a sticky session, which can help to get more consistent results.Set the skip property: The number of search results to skip.setSpeller
(QuerySpellerType speller) Set the speller property: Improve search recall by spell-correcting individual search query terms.Set the top property: The number of search results to retrieve.
-
Constructor Details
-
SearchOptions
public SearchOptions()
-
-
Method Details
-
isTotalCountIncluded
Get the includeTotalCount property: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation.- Returns:
- the includeTotalCount value.
-
setIncludeTotalCount
Set the includeTotalCount property: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation.- Parameters:
includeTotalCount
- the includeTotalCount value to set.- Returns:
- the SearchOptions object itself.
-
getFacets
Get the facets property: The list of facet expressions to apply to the search query. Each facet expression contains a field name, optionally followed by a comma-separated list of name:value pairs.- Returns:
- the facets value.
-
setFacets
Set the facets property: The list of facet expressions to apply to the search query. Each facet expression contains a field name, optionally followed by a comma-separated list of name:value pairs.- Parameters:
facets
- the facets value to set.- Returns:
- the SearchOptions object itself.
-
getFilter
Get the filter property: The OData $filter expression to apply to the search query.- Returns:
- the filter value.
-
setFilter
Set the filter property: The OData $filter expression to apply to the search query.- Parameters:
filter
- the filter value to set.- Returns:
- the SearchOptions object itself.
-
getHighlightFields
Get the highlightFields property: The list of field names to use for hit highlights. Only searchable fields can be used for hit highlighting.- Returns:
- the highlightFields value.
-
setHighlightFields
Set the highlightFields property: The list of field names to use for hit highlights. Only searchable fields can be used for hit highlighting.- Parameters:
highlightFields
- the highlightFields value to set.- Returns:
- the SearchOptions object itself.
-
getHighlightPostTag
Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>.- Returns:
- the highlightPostTag value.
-
setHighlightPostTag
Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is </em>.- Parameters:
highlightPostTag
- the highlightPostTag value to set.- Returns:
- the SearchOptions object itself.
-
getHighlightPreTag
Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>.- Returns:
- the highlightPreTag value.
-
setHighlightPreTag
Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is <em>.- Parameters:
highlightPreTag
- the highlightPreTag value to set.- Returns:
- the SearchOptions object itself.
-
getMinimumCoverage
Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 100.- Returns:
- the minimumCoverage value.
-
setMinimumCoverage
Set the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a search query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 100.- Parameters:
minimumCoverage
- the minimumCoverage value to set.- Returns:
- the SearchOptions object itself.
-
getOrderBy
Get the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no OrderBy is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.- Returns:
- the orderBy value.
-
setOrderBy
Set the orderBy property: The list of OData $orderby expressions by which to sort the results. Each expression can be either a field name or a call to either the geo.distance() or the search.score() functions. Each expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is ascending order. Ties will be broken by the match scores of documents. If no OrderBy is specified, the default sort order is descending by document match score. There can be at most 32 $orderby clauses.- Parameters:
orderBy
- the orderBy value to set.- Returns:
- the SearchOptions object itself.
-
getQueryType
Get the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax.- Returns:
- the queryType value.
-
setQueryType
Set the queryType property: A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax.- Parameters:
queryType
- the queryType value to set.- Returns:
- the SearchOptions object itself.
-
getScoringParameters
Get the scoringParameters property: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes).- Returns:
- the scoringParameters value.
-
setScoringParameters
Set the scoringParameters property: The list of parameter values to be used in scoring functions (for example, referencePointParameter) using the format name-values. For example, if the scoring profile defines a function with a parameter called 'mylocation' the parameter string would be "mylocation--122.2,44.8" (without the quotes).- Parameters:
scoringParameters
- the scoringParameters value to set.- Returns:
- the SearchOptions object itself.
-
getScoringProfile
Get the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.- Returns:
- the scoringProfile value.
-
setScoringProfile
Set the scoringProfile property: The name of a scoring profile to evaluate match scores for matching documents in order to sort the results.- Parameters:
scoringProfile
- the scoringProfile value to set.- Returns:
- the SearchOptions object itself.
-
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.
-
setSemanticConfigurationName
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 SearchOptions object itself.
-
getSearchFields
Get the searchFields property: The list of field names to which to scope the full-text search. When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take precedence over any field names listed in this parameter.- Returns:
- the searchFields value.
-
setSearchFields
Set the searchFields property: The list of field names to which to scope the full-text search. When using fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each fielded search expression take precedence over any field names listed in this parameter.- Parameters:
searchFields
- the searchFields value to set.- Returns:
- the SearchOptions object itself.
-
getQueryLanguage
Get the queryLanguage property: The language of the query.- Returns:
- the queryLanguage value.
-
setQueryLanguage
Set the queryLanguage property: The language of the query.- Parameters:
queryLanguage
- the queryLanguage value to set.- Returns:
- the SearchOptions object itself.
-
getSpeller
Get the speller property: Improve search recall by spell-correcting individual search query terms.- Returns:
- the speller value.
-
setSpeller
Set the speller property: Improve search recall by spell-correcting individual search query terms.- Parameters:
speller
- the speller value to set.- Returns:
- the SearchOptions object itself.
-
getAnswers
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-<number of answers>' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1.- Returns:
- the answers value.
-
setAnswers
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-<number of answers>' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1.- Parameters:
answers
- the answers value to set.- Returns:
- the SearchOptions object itself.
-
getAnswersCount
Get the answers count 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-<number of answers>' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1.- Returns:
- the answers count value.
-
setAnswersCount
Set the answers count 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-<number of answers>' option after the answers parameter value, such as 'extractive|count-3'. Default count is 1.- Parameters:
answersCount
- the answers count value to set.- Returns:
- the SearchOptions object itself.
-
getSearchMode
Get the searchMode property: A value that specifies whether any or all of the search terms must be matched in order to count the document as a match.- Returns:
- the searchMode value.
-
setSearchMode
Set the searchMode property: A value that specifies whether any or all of the search terms must be matched in order to count the document as a match.- Parameters:
searchMode
- the searchMode value to set.- Returns:
- the SearchOptions object itself.
-
getScoringStatistics
Get the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency.- Returns:
- the scoringStatistics value.
-
setScoringStatistics
Set the scoringStatistics property: A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency.- Parameters:
scoringStatistics
- the scoringStatistics value to set.- Returns:
- the SearchOptions object itself.
-
getSessionId
Get the sessionId property: A value to be used to create a sticky session, which can help to get more consistent results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the requests across replicas and adversely affect the performance of the search service. The value used as sessionId cannot start with a '_' character.- Returns:
- the sessionId value.
-
setSessionId
Set the sessionId property: A value to be used to create a sticky session, which can help to get more consistent results. As long as the same sessionId is used, a best-effort attempt will be made to target the same replica set. Be wary that reusing the same sessionID values repeatedly can interfere with the load balancing of the requests across replicas and adversely affect the performance of the search service. The value used as sessionId cannot start with a '_' character.- Parameters:
sessionId
- the sessionId value to set.- Returns:
- the SearchOptions object itself.
-
getSelect
Get the select property: The list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included.- Returns:
- the select value.
-
setSelect
Set the select property: The list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included.- Parameters:
select
- the select value to set.- Returns:
- the SearchOptions object itself.
-
getSkip
Get the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in sequence, but cannot use $skip due to this limitation, consider using $orderby on a totally-ordered key and $filter with a range query instead.- Returns:
- the skip value.
-
setSkip
Set the skip property: The number of search results to skip. This value cannot be greater than 100,000. If you need to scan documents in sequence, but cannot use $skip due to this limitation, consider using $orderby on a totally-ordered key and $filter with a range query instead.- Parameters:
skip
- the skip value to set.- Returns:
- the SearchOptions object itself.
-
getTop
Get the top property: The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results.- Returns:
- the top value.
-
setTop
Set the top property: The number of search results to retrieve. This can be used in conjunction with $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results.- Parameters:
top
- the top value to set.- Returns:
- the SearchOptions object itself.
-
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.
-
setQueryCaption
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 SearchOptions object itself.
-
getQueryCaptionHighlightEnabled
Get the query caption highlight 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 highlight value.
-
setQueryCaptionHighlightEnabled
Set the query caption highlight 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:
queryCaptionHighlightEnabled
- the query caption highlight value to set.- Returns:
- the SearchOptions object itself.
-
getSemanticFields
Get the semanticFields property: The list of field names used for semantic search.- Returns:
- the semanticFields value.
-
setSemanticFields
Set the semanticFields property: The list of field names used for semantic search.- Parameters:
semanticFields
- the semanticFields value to set.- Returns:
- the SearchOptions object itself.
-