public final class

SearchSuggestionSpec.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.appsearch.app.SearchSuggestionSpec.Builder

Overview

Builder for objects.

Summary

Constructors
publicBuilder(int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

Methods
public SearchSuggestionSpec.BuilderaddFilterDocumentClasses(java.lang.Class<java.lang.Object> documentClasses[])

Adds a schema filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterDocumentClasses(java.util.Collection<java.lang.Class> documentClasses)

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

public SearchSuggestionSpec.BuilderaddFilterDocumentIds(java.lang.String namespace, java.util.Collection<java.lang.String> documentIds)

Adds a document ID filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterDocumentIds(java.lang.String namespace, java.lang.String documentIds[])

Adds a document ID filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterNamespaces(java.util.Collection<java.lang.String> namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterNamespaces(java.lang.String namespaces[])

Adds a namespace filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterProperties(java.lang.Class<java.lang.Object> documentClass, java.util.Collection<java.lang.String> propertyPaths)

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

public SearchSuggestionSpec.BuilderaddFilterProperties(java.lang.String schema, java.util.Collection<java.lang.String> propertyPaths)

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

public SearchSuggestionSpec.BuilderaddFilterPropertyPaths(java.lang.Class<java.lang.Object> documentClass, java.util.Collection<PropertyPath> propertyPaths)

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

public SearchSuggestionSpec.BuilderaddFilterPropertyPaths(java.lang.String schema, java.util.Collection<PropertyPath> propertyPaths)

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

public SearchSuggestionSpec.BuilderaddFilterSchemas(java.util.Collection<java.lang.String> schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddFilterSchemas(java.lang.String schemaTypes[])

Adds a schema filter to SearchSuggestionSpec Entry.

public SearchSuggestionSpec.BuilderaddSearchStringParameters(java.util.List<java.lang.String> searchStringParameters)

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

public SearchSuggestionSpec.BuilderaddSearchStringParameters(java.lang.String searchStringParameters[])

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

public SearchSuggestionSpecbuild()

Constructs a new SearchSpec from the contents of this builder.

public SearchSuggestionSpec.BuildersetRankingStrategy(int rankingStrategy)

Sets ranking strategy for suggestion results.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

Parameters:

maximumResultCount: Sets the maximum number of suggestion in the returned object.

Methods

public SearchSuggestionSpec.Builder addFilterNamespaces(java.lang.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.

public SearchSuggestionSpec.Builder addFilterNamespaces(java.util.Collection<java.lang.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.

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.

public SearchSuggestionSpec.Builder addFilterSchemas(java.lang.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.

public SearchSuggestionSpec.Builder addFilterSchemas(java.util.Collection<java.lang.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.

public SearchSuggestionSpec.Builder addFilterDocumentClasses(java.lang.Class<java.lang.Object> documentClasses[])

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 SearchSuggestionSpec.getFilterSchemas().

Parameters:

documentClasses: classes annotated with Document.

public SearchSuggestionSpec.Builder addFilterDocumentClasses(java.util.Collection<java.lang.Class> documentClasses)

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 SearchSuggestionSpec.getFilterSchemas().

Parameters:

documentClasses: classes annotated with Document.

public SearchSuggestionSpec.Builder addFilterProperties(java.lang.String schema, java.util.Collection<java.lang.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: the AppSearchSchema that contains the target properties
propertyPaths: The String version of PropertyPath. A dot-delimited sequence of property names indicating which property in the document these snippets correspond to.

public SearchSuggestionSpec.Builder addFilterPropertyPaths(java.lang.String schema, java.util.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: the AppSearchSchema that contains the target properties
propertyPaths: The PropertyPath to search suggestion over

public SearchSuggestionSpec.Builder addFilterProperties(java.lang.Class<java.lang.Object> documentClass, java.util.Collection<java.lang.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.

Parameters:

documentClass: class annotated with Document.
propertyPaths: The String version of PropertyPath. A {@code dot-delimited sequence of property names indicating which property in the document these snippets correspond to.

public SearchSuggestionSpec.Builder addFilterPropertyPaths(java.lang.Class<java.lang.Object> documentClass, java.util.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:

documentClass: class annotated with Document.
propertyPaths: The PropertyPath to search suggestion over

public SearchSuggestionSpec.Builder addFilterDocumentIds(java.lang.String namespace, java.lang.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.

public SearchSuggestionSpec.Builder addFilterDocumentIds(java.lang.String namespace, java.util.Collection<java.lang.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.

public SearchSuggestionSpec.Builder addSearchStringParameters(java.lang.String searchStringParameters[])

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

See also: AppSearchSession.search(String, SearchSpec)

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

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

See also: AppSearchSession.search(String, SearchSpec)

public SearchSuggestionSpec build()

Constructs a new SearchSpec from the contents of this builder.