SearchSuggestionSpec.Builder
public final class SearchSuggestionSpec.Builder
Builder for objects.
Summary
Public constructors |
|---|
|
Creates an |
Public methods |
|
|---|---|
@NonNull SearchSuggestionSpec.Builder |
addFilterDocumentClasses(@NonNull Class[] documentClasses)Adds a schema filter to |
@NonNull SearchSuggestionSpec.Builder |
addFilterDocumentClasses(Adds the Schema names of given document classes to the Schema type filter of |
@NonNull SearchSuggestionSpec.Builder |
addFilterDocumentIds(Adds a document ID filter to |
@NonNull SearchSuggestionSpec.Builder |
addFilterDocumentIds(Adds a document ID filter to |
@NonNull SearchSuggestionSpec.Builder |
addFilterNamespaces(@NonNull String[] namespaces)Adds a namespace filter to |
@NonNull SearchSuggestionSpec.Builder |
addFilterNamespaces(@NonNull Collection<String> namespaces)Adds a namespace filter to |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)Adds property paths for the specified type to the property filter of |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)Adds property paths for the specified type to the property filter of |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)Adds property paths for the specified type to the property filter of |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)Adds property paths for the specified type to the property filter of |
@NonNull SearchSuggestionSpec.Builder |
addFilterSchemas(@NonNull String[] schemaTypes)Adds a schema filter to |
@NonNull SearchSuggestionSpec.Builder |
addFilterSchemas(@NonNull Collection<String> schemaTypes)Adds a schema filter to |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function. |
@NonNull SearchSuggestionSpec.Builder |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function. |
@NonNull SearchSuggestionSpec |
build()Constructs a new |
@NonNull SearchSuggestionSpec.Builder |
setRankingStrategy(int rankingStrategy)Sets ranking strategy for suggestion results. |
Public constructors
Builder
public Builder(@IntRange(from = 1) int maximumResultCount)
Creates an SearchSuggestionSpec.Builder object.
| Parameters | |
|---|---|
@IntRange(from = 1) int maximumResultCount |
Sets the maximum number of suggestion in the returned object. |
Public methods
addFilterDocumentClasses
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentClasses(@NonNull Class[] 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 getFilterSchemas.
addFilterDocumentClasses
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentClasses(
@NonNull Collection<Class<Object>> 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 getFilterSchemas.
| Parameters | |
|---|---|
@NonNull Collection<Class<Object>> documentClasses |
classes annotated with |
addFilterDocumentIds
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentIds(
@NonNull String namespace,
@NonNull 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.
addFilterDocumentIds
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentIds(
@NonNull String namespace,
@NonNull 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.
addFilterNamespaces
public @NonNull SearchSuggestionSpec.Builder addFilterNamespaces(@NonNull 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.
addFilterNamespaces
public @NonNull SearchSuggestionSpec.Builder addFilterNamespaces(@NonNull 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.
addFilterProperties
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
public @NonNull SearchSuggestionSpec.Builder addFilterProperties(
@NonNull Class<Object> documentClass,
@NonNull 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.
| Parameters | |
|---|---|
@NonNull Class<Object> documentClass |
class annotated with |
@NonNull Collection<String> propertyPaths |
The String version of |
addFilterProperties
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
public @NonNull SearchSuggestionSpec.Builder addFilterProperties(
@NonNull String schema,
@NonNull 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 | |
|---|---|
@NonNull String schema |
the |
@NonNull Collection<String> propertyPaths |
The String version of |
addFilterPropertyPaths
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
public @NonNull SearchSuggestionSpec.Builder addFilterPropertyPaths(
@NonNull Class<Object> documentClass,
@NonNull 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 | |
|---|---|
@NonNull Class<Object> documentClass |
class annotated with |
@NonNull Collection<PropertyPath> propertyPaths |
The |
addFilterPropertyPaths
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_ADD_FILTER_PROPERTIES)
public @NonNull SearchSuggestionSpec.Builder addFilterPropertyPaths(
@NonNull String schema,
@NonNull 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 | |
|---|---|
@NonNull String schema |
the |
@NonNull Collection<PropertyPath> propertyPaths |
The |
addFilterSchemas
public @NonNull SearchSuggestionSpec.Builder addFilterSchemas(@NonNull 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.
addFilterSchemas
public @NonNull SearchSuggestionSpec.Builder addFilterSchemas(@NonNull 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.
addSearchStringParameters
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
public @NonNull SearchSuggestionSpec.Builder addSearchStringParameters(@NonNull String[] searchStringParameters)
Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.
| See also | |
|---|---|
search |
addSearchStringParameters
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SEARCH_SPEC_SEARCH_STRING_PARAMETERS)
public @NonNull SearchSuggestionSpec.Builder addSearchStringParameters(@NonNull List<String> searchStringParameters)
Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.
| See also | |
|---|---|
search |
build
public @NonNull SearchSuggestionSpec build()
Constructs a new SearchSpec from the contents of this builder.
setRankingStrategy
public @NonNull SearchSuggestionSpec.Builder setRankingStrategy(int rankingStrategy)
Sets ranking strategy for suggestion results.
The default value SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT will be used if this method is never called.