Added in API level 34

Builder

class Builder
kotlin.Any
   ↳ android.app.appsearch.SearchSuggestionSpec.Builder

Builder for objects.

Summary

Public constructors
Builder(maximumResultCount: Int)

Creates an SearchSuggestionSpec.Builder object.

Public methods
SearchSuggestionSpec.Builder
addFilterDocumentIds(namespace: String, vararg documentIds: String!)

Adds a document ID filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
addFilterDocumentIds(namespace: String, documentIds: MutableCollection<String!>)

Adds a document ID filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
addFilterNamespaces(vararg namespaces: String!)

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
addFilterProperties(schema: String, propertyPaths: MutableCollection<String!>)

Adds property paths for the specified type to the property filter of SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds property paths for the specified type to the property filter of SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
addFilterSchemas(vararg schemaTypes: String!)

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec

Constructs a new SearchSpec from the contents of this builder.

SearchSuggestionSpec.Builder
setRankingStrategy(rankingStrategy: Int)

Sets ranking strategy for suggestion results.

Public constructors

Builder

Added in API level 34
Builder(maximumResultCount: Int)

Creates an SearchSuggestionSpec.Builder object.

Parameters
maximumResultCount Int: Sets the maximum number of suggestion in the returned object. Value is 1 or greater

Public methods

addFilterDocumentIds

Added in API level 34
fun addFilterDocumentIds(
    namespace: String,
    vararg documentIds: String!
): SearchSuggestionSpec.Builder

Adds a document ID filter to SearchSuggestionSpec Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

Parameters
namespace String: This value cannot be null.
documentIds String!: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

addFilterDocumentIds

Added in API level 34
fun addFilterDocumentIds(
    namespace: String,
    documentIds: MutableCollection<String!>
): SearchSuggestionSpec.Builder

Adds a document ID filter to SearchSuggestionSpec Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

Parameters
namespace String: This value cannot be null.
documentIds MutableCollection<String!>: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

addFilterNamespaces

Added in API level 34
fun addFilterNamespaces(vararg namespaces: String!): SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

Parameters
namespaces String!: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

addFilterNamespaces

Added in API level 34
fun addFilterNamespaces(namespaces: MutableCollection<String!>): SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

Parameters
namespaces MutableCollection<String!>: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

addFilterProperties

fun addFilterProperties(
    schema: String,
    propertyPaths: MutableCollection<String!>
): SearchSuggestionSpec.Builder

Adds property paths for the specified type to the property filter of SearchSuggestionSpec Entry. Only search for suggestions that has content under the specified property. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type.

If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

Example properties: 'body', 'sender.name', 'sender.emailaddress', etc.

Parameters
schema String: the AppSearchSchema that contains the target properties This value cannot be null.
propertyPaths MutableCollection<String!>: The String version of PropertyPath. A dot-delimited sequence of property names indicating which property in the document these snippets correspond to. This value cannot be null.

addFilterPropertyPaths

fun addFilterPropertyPaths(
    schema: String,
    propertyPaths: MutableCollection<PropertyPath!>
): SearchSuggestionSpec.Builder

Adds property paths for the specified type to the property filter of SearchSuggestionSpec Entry. Only search for suggestions that has content under the specified property. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type.

If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

Parameters
schema String: the AppSearchSchema that contains the target properties This value cannot be null.
propertyPaths MutableCollection<PropertyPath!>: The PropertyPath to search suggestion over This value cannot be null.

addFilterSchemas

Added in API level 34
fun addFilterSchemas(vararg schemaTypes: String!): SearchSuggestionSpec.Builder

Adds a schema filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

Parameters
schemaTypes String!: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

addFilterSchemas

Added in API level 34
fun addFilterSchemas(schemaTypes: MutableCollection<String!>): SearchSuggestionSpec.Builder

Adds a schema filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

Parameters
schemaTypes MutableCollection<String!>: This value cannot be null.
Return
SearchSuggestionSpec.Builder This value cannot be null.

build

Added in API level 34
fun build(): SearchSuggestionSpec

Constructs a new SearchSpec from the contents of this builder.

Return
SearchSuggestionSpec This value cannot be null.

setRankingStrategy

Added in API level 34
fun setRankingStrategy(rankingStrategy: Int): SearchSuggestionSpec.Builder

Sets ranking strategy for suggestion results.

The default value SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT will be used if this method is never called.

Parameters
rankingStrategy Int: Value is android.app.appsearch.SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_NONE, android.app.appsearch.SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT, or android.app.appsearch.SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_TERM_FREQUENCY
Return
SearchSuggestionSpec.Builder This value cannot be null.