SuggestOptions Class

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

public final class SuggestOptions

Options for suggest API.

Constructor Summary

Constructor Description
SuggestOptions(String searchText, String suggesterName)

Creates an instance of SuggestOptions class.

Method Summary

Modifier and Type Method and Description
String getFilter()

Get the filter property: An OData expression that filters the documents considered for suggestions.

String getHighlightPostTag()

Get the highlightPostTag property: A string tag that is appended to hit highlights.

String getHighlightPreTag()

Get the highlightPreTag property: A string tag that is prepended to hit highlights.

Double getMinimumCoverage()

Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestion query in order for the query to be reported as a success.

List<String> getOrderBy()

Get the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results.

List<String> getSearchFields()

Get the searchFields property: The comma-separated list of field names to search for the specified search text.

String getSearchText()

Get the searchText property: The search text to use to suggest documents.

List<String> getSelect()

Get the select property: The comma-separated list of fields to retrieve.

String getSuggesterName()

Get the suggesterName property: The name of the suggester as specified in the suggesters collection that's part of the index definition.

Integer getTop()

Get the top property: The number of suggestions to retrieve.

Boolean isUseFuzzyMatching()

Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query.

SuggestOptions setFilter(String filter)

Set the filter property: An OData expression that filters the documents considered for suggestions.

SuggestOptions setHighlightPostTag(String highlightPostTag)

Set the highlightPostTag property: A string tag that is appended to hit highlights.

SuggestOptions setHighlightPreTag(String highlightPreTag)

Set the highlightPreTag property: A string tag that is prepended to hit highlights.

SuggestOptions 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 suggestion query in order for the query to be reported as a success.

SuggestOptions setOrderBy(List<String> orderBy)

Set the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results.

SuggestOptions setOrderBy(String[] orderBy)

Set the orderBy property: The comma-separated list of OData $orderby expressions by which to sort the results.

SuggestOptions setSearchFields(List<String> searchFields)

Set the searchFields property: The comma-separated list of field names to search for the specified search text.

SuggestOptions setSearchFields(String[] searchFields)

Set the searchFields property: The comma-separated list of field names to search for the specified search text.

SuggestOptions setSelect(List<String> select)

Set the select property: The comma-separated list of fields to retrieve.

SuggestOptions setSelect(String[] select)

Set the select property: The comma-separated list of fields to retrieve.

SuggestOptions setTop(Integer top)

Set the top property: The number of suggestions to retrieve.

SuggestOptions setUseFuzzyMatching(Boolean useFuzzyMatching)

Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query.

Methods inherited from java.lang.Object

Constructor Details

SuggestOptions

public SuggestOptions(String searchText, String suggesterName)

Creates an instance of SuggestOptions class.

Parameters:

searchText - the searchText value to set.
suggesterName - the suggesterName value to set.

Method Details

getFilter

public String getFilter()

Get the filter property: An OData expression that filters the documents considered for suggestions.

Returns:

the filter value.

getHighlightPostTag

public String getHighlightPostTag()

Get the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting of suggestions is disabled.

Returns:

the highlightPostTag value.

getHighlightPreTag

public String getHighlightPreTag()

Get the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting of suggestions is disabled.

Returns:

the highlightPreTag value.

getMinimumCoverage

public Double getMinimumCoverage()

Get the minimumCoverage property: A number between 0 and 100 indicating the percentage of the index that must be covered by a suggestion 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 80.

Returns:

the minimumCoverage value.

getOrderBy

public List<String> getOrderBy()

Get the orderBy property: The comma-separated 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, or 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.

getSearchFields

public List<String> getSearchFields()

Get the searchFields property: The comma-separated list of field names to search for the specified search text. Target fields must be included in the specified suggester.

Returns:

the searchFields value.

getSearchText

public String getSearchText()

Get the searchText property: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters.

Returns:

the searchText value.

getSelect

public List<String> getSelect()

Get the select property: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results.

Returns:

the select value.

getSuggesterName

public String getSuggesterName()

Get the suggesterName property: The name of the suggester as specified in the suggesters collection that's part of the index definition.

Returns:

the suggesterName value.

getTop

public Integer getTop()

Get the top property: The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5.

Returns:

the top value.

isUseFuzzyMatching

public Boolean isUseFuzzyMatching()

Get the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query. Default is false. When set to true, the query will find suggestions even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestion searches are slower and consume more resources.

Returns:

the useFuzzyMatching value.

setFilter

public SuggestOptions setFilter(String filter)

Set the filter property: An OData expression that filters the documents considered for suggestions.

Parameters:

filter - the filter value to set.

Returns:

the SuggestOptions object itself.

setHighlightPostTag

public SuggestOptions setHighlightPostTag(String highlightPostTag)

Set the highlightPostTag property: A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit highlighting of suggestions is disabled.

Parameters:

highlightPostTag - the highlightPostTag value to set.

Returns:

the SuggestOptions object itself.

setHighlightPreTag

public SuggestOptions setHighlightPreTag(String highlightPreTag)

Set the highlightPreTag property: A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, hit highlighting of suggestions is disabled.

Parameters:

highlightPreTag - the highlightPreTag value to set.

Returns:

the SuggestOptions object itself.

setMinimumCoverage

public SuggestOptions 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 suggestion 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 80.

Parameters:

minimumCoverage - the minimumCoverage value to set.

Returns:

the SuggestOptions object itself.

setOrderBy

public SuggestOptions setOrderBy(List<String> orderBy)

Set the orderBy property: The comma-separated 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, or 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 SuggestOptions object itself.

setOrderBy

public SuggestOptions setOrderBy(String[] orderBy)

Set the orderBy property: The comma-separated 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, or 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 SuggestOptions object itself.

setSearchFields

public SuggestOptions setSearchFields(List<String> searchFields)

Set the searchFields property: The comma-separated list of field names to search for the specified search text. Target fields must be included in the specified suggester.

Parameters:

searchFields - the searchFields value to set.

Returns:

the SuggestOptions object itself.

setSearchFields

public SuggestOptions setSearchFields(String[] searchFields)

Set the searchFields property: The comma-separated list of field names to search for the specified search text. Target fields must be included in the specified suggester.

Parameters:

searchFields - the searchFields value to set.

Returns:

the SuggestOptions object itself.

setSelect

public SuggestOptions setSelect(List<String> select)

Set the select property: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results.

Parameters:

select - the select value to set.

Returns:

the SuggestOptions object itself.

setSelect

public SuggestOptions setSelect(String[] select)

Set the select property: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results.

Parameters:

select - the select value to set.

Returns:

the SuggestOptions object itself.

setTop

public SuggestOptions setTop(Integer top)

Set the top property: The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5.

Parameters:

top - the top value to set.

Returns:

the SuggestOptions object itself.

setUseFuzzyMatching

public SuggestOptions setUseFuzzyMatching(Boolean useFuzzyMatching)

Set the useFuzzyMatching property: A value indicating whether to use fuzzy matching for the suggestion query. Default is false. When set to true, the query will find suggestions even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios, it comes at a performance cost as fuzzy suggestion searches are slower and consume more resources.

Parameters:

useFuzzyMatching - the useFuzzyMatching value to set.

Returns:

the SuggestOptions object itself.

Applies to