commonMain.aws.sdk.kotlin.services.cloudsearch.model.DocumentSuggesterOptions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudsearch-jvm Show documentation
Show all versions of cloudsearch-jvm Show documentation
The AWS SDK for Kotlin client for CloudSearch
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.cloudsearch.model
/**
* Options for a search suggester.
*/
public class DocumentSuggesterOptions private constructor(builder: Builder) {
/**
* The level of fuzziness allowed when suggesting matches for a string: `none`, `low`, or `high`. With none, the specified string is treated as an exact prefix. With low, suggestions must differ from the specified string by no more than one character. With high, suggestions can differ by up to two characters. The default is none.
*/
public val fuzzyMatching: aws.sdk.kotlin.services.cloudsearch.model.SuggesterFuzzyMatching? = builder.fuzzyMatching
/**
* An expression that computes a score for each suggestion to control how they are sorted. The scores are rounded to the nearest integer, with a floor of 0 and a ceiling of 2^31-1. A document's relevance score is not computed for suggestions, so sort expressions cannot reference the `_score` value. To sort suggestions using a numeric field or existing expression, simply specify the name of the field or expression. If no expression is configured for the suggester, the suggestions are sorted with the closest matches listed first.
*/
public val sortExpression: kotlin.String? = builder.sortExpression
/**
* The name of the index field you want to use for suggestions.
*/
public val sourceField: kotlin.String = requireNotNull(builder.sourceField) { "A non-null value must be provided for sourceField" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.cloudsearch.model.DocumentSuggesterOptions = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("DocumentSuggesterOptions(")
append("fuzzyMatching=$fuzzyMatching,")
append("sortExpression=$sortExpression,")
append("sourceField=$sourceField")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = fuzzyMatching?.hashCode() ?: 0
result = 31 * result + (sortExpression?.hashCode() ?: 0)
result = 31 * result + (sourceField.hashCode())
return result
}
override fun equals(other: kotlin.Any?): kotlin.Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as DocumentSuggesterOptions
if (fuzzyMatching != other.fuzzyMatching) return false
if (sortExpression != other.sortExpression) return false
if (sourceField != other.sourceField) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.cloudsearch.model.DocumentSuggesterOptions = Builder(this).apply(block).build()
public class Builder {
/**
* The level of fuzziness allowed when suggesting matches for a string: `none`, `low`, or `high`. With none, the specified string is treated as an exact prefix. With low, suggestions must differ from the specified string by no more than one character. With high, suggestions can differ by up to two characters. The default is none.
*/
public var fuzzyMatching: aws.sdk.kotlin.services.cloudsearch.model.SuggesterFuzzyMatching? = null
/**
* An expression that computes a score for each suggestion to control how they are sorted. The scores are rounded to the nearest integer, with a floor of 0 and a ceiling of 2^31-1. A document's relevance score is not computed for suggestions, so sort expressions cannot reference the `_score` value. To sort suggestions using a numeric field or existing expression, simply specify the name of the field or expression. If no expression is configured for the suggester, the suggestions are sorted with the closest matches listed first.
*/
public var sortExpression: kotlin.String? = null
/**
* The name of the index field you want to use for suggestions.
*/
public var sourceField: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.cloudsearch.model.DocumentSuggesterOptions) : this() {
this.fuzzyMatching = x.fuzzyMatching
this.sortExpression = x.sortExpression
this.sourceField = x.sourceField
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.cloudsearch.model.DocumentSuggesterOptions = DocumentSuggesterOptions(this)
internal fun correctErrors(): Builder {
if (sourceField == null) sourceField = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy