SearchSuggestionSpec.Builder


public static final class SearchSuggestionSpec.Builder
extends Object

java.lang.Object
   ↳ android.app.appsearch.SearchSuggestionSpec.Builder


Builder for objects.

Summary

Public constructors

Builder(int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

Public methods

SearchSuggestionSpec.Builder addFilterDocumentIds(String namespace, String... documentIds)

Adds a document ID filter to SearchSuggestionSpec Entry.

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

Adds a document ID filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder addFilterNamespaces(Collection<String> namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder addFilterNamespaces(String... namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder addFilterProperties(String schema, Collection<String> propertyPaths)

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

SearchSuggestionSpec.Builder addFilterPropertyPaths(String schema, Collection<PropertyPath> propertyPaths)

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

SearchSuggestionSpec.Builder addFilterSchemas(String... schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder addFilterSchemas(Collection<String> schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry.

SearchSuggestionSpec.Builder addSearchStringParameters(String... searchStringParameters)

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

SearchSuggestionSpec.Builder addSearchStringParameters(List<String> searchStringParameters)

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

SearchSuggestionSpec build()

Constructs a new SearchSpec from the contents of this builder.

SearchSuggestionSpec.Builder setRankingStrategy(int rankingStrategy)

Sets ranking strategy for suggestion results.

Inherited methods

Public constructors

Builder

Added in API level 34
Also in T Extensions 7
public Builder (int maximumResultCount)

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
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterDocumentIds (String namespace, 
                String... documentIds)

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.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addFilterDocumentIds

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterDocumentIds (String namespace, 
                Collection<String> documentIds)

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 Collection: This value cannot be null.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addFilterNamespaces

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterNamespaces (Collection<String> namespaces)

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 Collection: This value cannot be null.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addFilterNamespaces

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterNamespaces (String... namespaces)

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.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addFilterProperties

Added in API level 35
Also in T Extensions 13
public SearchSuggestionSpec.Builder addFilterProperties (String schema, 
                Collection<String> propertyPaths)

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 Collection: 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.

Returns
SearchSuggestionSpec.Builder

addFilterPropertyPaths

Added in API level 35
Also in T Extensions 13
public SearchSuggestionSpec.Builder addFilterPropertyPaths (String schema, 
                Collection<PropertyPath> propertyPaths)

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 Collection: The PropertyPath to search suggestion over This value cannot be null.

Returns
SearchSuggestionSpec.Builder

addFilterSchemas

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterSchemas (String... schemaTypes)

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.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addFilterSchemas

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder addFilterSchemas (Collection<String> schemaTypes)

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 Collection: This value cannot be null.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addSearchStringParameters

public SearchSuggestionSpec.Builder addSearchStringParameters (String... searchStringParameters)

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

Parameters
searchStringParameters String: This value cannot be null.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

addSearchStringParameters

public SearchSuggestionSpec.Builder addSearchStringParameters (List<String> searchStringParameters)

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

Parameters
searchStringParameters List: This value cannot be null.

Returns
SearchSuggestionSpec.Builder This value cannot be null.

build

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec build ()

Constructs a new SearchSpec from the contents of this builder.

Returns
SearchSuggestionSpec This value cannot be null.

setRankingStrategy

Added in API level 34
Also in T Extensions 7
public SearchSuggestionSpec.Builder setRankingStrategy (int rankingStrategy)

Sets ranking strategy for suggestion results.

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

Parameters
rankingStrategy int: Value is SearchSuggestionSpec.SUGGESTION_RANKING_STRATEGY_NONE, SearchSuggestionSpec.SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT, or SearchSuggestionSpec.SUGGESTION_RANKING_STRATEGY_TERM_FREQUENCY

Returns
SearchSuggestionSpec.Builder This value cannot be null.