SearchSuggestionSpec.Builder


class SearchSuggestionSpec.Builder


Builder for objects.

Summary

Public constructors

Builder(maximumResultCount: @IntRange(from = 1) Int)

Creates an SearchSuggestionSpec.Builder object.

Public functions

SearchSuggestionSpec.Builder
addFilterDocumentClasses(documentClasses: Array<Class<Any!>!>)

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
addFilterDocumentClasses(
    documentClasses: (Mutable)Collection<Class<Any!>!>
)

Adds the Schema names of given document classes to the Schema type filter of SearchSuggestionSpec Entry.

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

Adds a document ID filter to SearchSuggestionSpec Entry.

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

Adds a document ID filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
addFilterProperties(
    documentClass: Class<Any!>,
    propertyPaths: (Mutable)Collection<String!>
)

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

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
addFilterProperties(
    schema: String,
    propertyPaths: (Mutable)Collection<String!>
)

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

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
addFilterPropertyPaths(
    documentClass: Class<Any!>,
    propertyPaths: (Mutable)Collection<PropertyPath!>
)

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

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
addFilterPropertyPaths(
    schema: String,
    propertyPaths: (Mutable)Collection<PropertyPath!>
)

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

SearchSuggestionSpec.Builder
addFilterSchemas(schemaTypes: Array<String!>)

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
addSearchStringParameters(searchStringParameters: Array<String!>)

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

SearchSuggestionSpec.Builder
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
addSearchStringParameters(
    searchStringParameters: (Mutable)List<String!>
)

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

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 1.1.0-alpha07
Builder(maximumResultCount: @IntRange(from = 1) Int)

Creates an SearchSuggestionSpec.Builder object.

Parameters
maximumResultCount: @IntRange(from = 1) Int

Sets the maximum number of suggestion in the returned object.

Public functions

addFilterDocumentClasses

fun addFilterDocumentClasses(documentClasses: Array<Class<Any!>!>): 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.

Merged list available from getFilterSchemas.

Parameters
documentClasses: Array<Class<Any!>!>

classes annotated with Document.

addFilterDocumentClasses

Added in 1.1.0-alpha07
fun addFilterDocumentClasses(
    documentClasses: (Mutable)Collection<Class<Any!>!>
): SearchSuggestionSpec.Builder

Adds the Schema names of given document classes to the Schema type filter of SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

Merged list available from getFilterSchemas.

Parameters
documentClasses: (Mutable)Collection<Class<Any!>!>

classes annotated with Document.

addFilterDocumentIds

fun addFilterDocumentIds(namespace: String, documentIds: Array<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.

addFilterDocumentIds

Added in 1.1.0-alpha07
fun addFilterDocumentIds(
    namespace: String,
    documentIds: (Mutable)Collection<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.

addFilterNamespaces

fun addFilterNamespaces(namespaces: Array<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.

addFilterNamespaces

Added in 1.1.0-alpha07
fun addFilterNamespaces(namespaces: (Mutable)Collection<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.

addFilterProperties

Added in 1.1.0-alpha07
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
fun addFilterProperties(
    documentClass: Class<Any!>,
    propertyPaths: (Mutable)Collection<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.

Parameters
documentClass: Class<Any!>

class annotated with Document.

propertyPaths: (Mutable)Collection<String!>

The String version of PropertyPath. A dot-delimited sequence of property names indicating which property in the document these snippets correspond to.

addFilterProperties

Added in 1.1.0-alpha07
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
fun addFilterProperties(
    schema: String,
    propertyPaths: (Mutable)Collection<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

propertyPaths: (Mutable)Collection<String!>

The String version of PropertyPath. A dot-delimited sequence of property names indicating which property in the document these snippets correspond to.

addFilterPropertyPaths

Added in 1.1.0-alpha07
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
fun addFilterPropertyPaths(
    documentClass: Class<Any!>,
    propertyPaths: (Mutable)Collection<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
documentClass: Class<Any!>

class annotated with Document.

propertyPaths: (Mutable)Collection<PropertyPath!>

The PropertyPath to search suggestion over

addFilterPropertyPaths

Added in 1.1.0-alpha07
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
fun addFilterPropertyPaths(
    schema: String,
    propertyPaths: (Mutable)Collection<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

propertyPaths: (Mutable)Collection<PropertyPath!>

The PropertyPath to search suggestion over

addFilterSchemas

fun addFilterSchemas(schemaTypes: Array<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.

addFilterSchemas

Added in 1.1.0-alpha07
fun addFilterSchemas(schemaTypes: (Mutable)Collection<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.

addSearchStringParameters

@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
fun addSearchStringParameters(searchStringParameters: Array<String!>): SearchSuggestionSpec.Builder

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

See also
search

addSearchStringParameters

Added in 1.1.0-alpha07
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
fun addSearchStringParameters(
    searchStringParameters: (Mutable)List<String!>
): SearchSuggestionSpec.Builder

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

See also
search

build

Added in 1.1.0-alpha07
fun build(): SearchSuggestionSpec

Constructs a new SearchSpec from the contents of this builder.

setRankingStrategy

Added in 1.1.0-alpha07
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.