SearchSuggestionSpec.Builder

public static final class SearchSuggestionSpec.Builder extends Object

Builder for objects.

Public Constructor Summary

Builder(int maximumResultCount)
Creates an SearchSuggestionSpec.Builder object.

Public Method Summary

SearchSuggestionSpec.Builder
addFilterDocumentIds(String namespace, Collection<String> documentIds)
Adds a document ID filter to SearchSuggestionSpec Entry.
SearchSuggestionSpec.Builder
addFilterDocumentIds(String namespace, 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(Collection<String> schemaTypes)
Adds a schema filter to SearchSuggestionSpec Entry.
SearchSuggestionSpec.Builder
addFilterSchemas(String... schemaTypes)
Adds a schema filter to SearchSuggestionSpec Entry.
SearchSuggestionSpec
build()
Constructs a new SearchSpec from the contents of this builder.
SearchSuggestionSpec.Builder
setRankingStrategy(int rankingStrategy)
Sets ranking strategy for suggestion results.

Inherited Method Summary

Public Constructors

public Builder (int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

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

Public Methods

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.

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.

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.

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.

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 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 (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 the AppSearchSchema that contains the target properties
propertyPaths The PropertyPath to search suggestion over

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.

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.

public SearchSuggestionSpec build ()

Constructs a new SearchSpec from the contents of this builder.

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.