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 |
Public methods | |
---|---|
SearchSuggestionSpec.Builder
|
addFilterDocumentIds(String namespace, String... documentIds)
Adds a document ID filter to |
SearchSuggestionSpec.Builder
|
addFilterDocumentIds(String namespace, Collection<String> documentIds)
Adds a document ID filter to |
SearchSuggestionSpec.Builder
|
addFilterNamespaces(Collection<String> namespaces)
Adds a namespace filter to |
SearchSuggestionSpec.Builder
|
addFilterNamespaces(String... namespaces)
Adds a namespace filter to |
SearchSuggestionSpec.Builder
|
addFilterProperties(String schema, Collection<String> propertyPaths)
Adds property paths for the specified type to the property filter of |
SearchSuggestionSpec.Builder
|
addFilterPropertyPaths(String schema, Collection<PropertyPath> propertyPaths)
Adds property paths for the specified type to the property filter of |
SearchSuggestionSpec.Builder
|
addFilterSchemas(String... schemaTypes)
Adds a schema filter to |
SearchSuggestionSpec.Builder
|
addFilterSchemas(Collection<String> schemaTypes)
Adds a schema filter to |
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 |
SearchSuggestionSpec.Builder
|
setRankingStrategy(int rankingStrategy)
Sets ranking strategy for suggestion results. |
Inherited methods | |
---|---|
Public constructors
Builder
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
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
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
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
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
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
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
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
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
public SearchSuggestionSpec build ()
Constructs a new SearchSpec
from the contents of this builder.
Returns | |
---|---|
SearchSuggestionSpec |
This value cannot be null . |
setRankingStrategy
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 . |