AppSearchSchema.DocumentPropertyConfig.Builder
public
static
final
class
AppSearchSchema.DocumentPropertyConfig.Builder
extends Object
java.lang.Object | |
↳ | android.app.appsearch.AppSearchSchema.DocumentPropertyConfig.Builder |
Builder for DocumentPropertyConfig
.
Summary
Public constructors | |
---|---|
Builder(String propertyName, String schemaType)
Creates a new |
Public methods | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder
|
addIndexableNestedProperties(String... indexableNestedProperties)
Adds one or more properties for indexing from the nested document property. |
AppSearchSchema.DocumentPropertyConfig.Builder
|
addIndexableNestedProperties(Collection<String> indexableNestedProperties)
Adds one or more properties for indexing from the nested document. |
AppSearchSchema.DocumentPropertyConfig.Builder
|
addIndexableNestedPropertyPaths(PropertyPath... indexableNestedPropertyPaths)
Adds one or more property paths for indexing from the nested document property. |
AppSearchSchema.DocumentPropertyConfig.Builder
|
addIndexableNestedPropertyPaths(Collection<PropertyPath> indexableNestedPropertyPaths)
Adds one or more property paths for indexing from the nested document property. |
AppSearchSchema.DocumentPropertyConfig
|
build()
Constructs a new |
AppSearchSchema.DocumentPropertyConfig.Builder
|
setCardinality(int cardinality)
Sets the cardinality of the property (whether it is optional, required or repeated). |
AppSearchSchema.DocumentPropertyConfig.Builder
|
setShouldIndexNestedProperties(boolean indexNestedProperties)
Configures whether properties in the nested document should be indexed according to that document's schema. |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (String propertyName, String schemaType)
Creates a new DocumentPropertyConfig.Builder
.
Parameters | |
---|---|
propertyName |
String : The logical name of the property in the schema, which will be
used as the key for this property in GenericDocument.Builder.setPropertyDocument(String, GenericDocument) .
This value cannot be null . |
schemaType |
String : The type of documents which will be stored in this property.
Documents of different types cannot be mixed into a single property.
This value cannot be null . |
Public methods
addIndexableNestedProperties
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties (String... indexableNestedProperties)
Adds one or more properties for indexing from the nested document property.
Parameters | |
---|---|
indexableNestedProperties |
String : This value cannot be null . |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |
See also:
addIndexableNestedProperties
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties (Collection<String> indexableNestedProperties)
Adds one or more properties for indexing from the nested document. The added property will be indexed according to that property's indexing configurations in the document's schema definition. All properties in this list will consume a sectionId regardless of its actual indexing config -- this includes properties added that do not actually exist, as well as properties that are not set as indexable in the nested schema type.
Input strings should follow the format of the property path for the nested property, with '.' as the path separator. This nested document's property name should not be included in the property path.
Ex. Consider an 'Organization' schema type which defines a nested document property 'address' (Address schema type), where Address has a nested document property 'country' (Country schema type with string 'name' property), and a string 'street' property. The 'street' and 'country's name' properties from the 'address' document property can be indexed for the 'Organization' schema type by calling:
OrganizationSchema.addProperty(
new DocumentPropertyConfig.Builder("address", "Address")
.addIndexableNestedProperties("street", "country.name")
.build()).
setShouldIndexNestedProperties(boolean)
is required
to be false if any indexable nested property is added this way for the document
property. Attempting to build a DocumentPropertyConfig when this is not true throws
IllegalArgumentException
.
Parameters | |
---|---|
indexableNestedProperties |
Collection : This value cannot be null . |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |
addIndexableNestedPropertyPaths
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths (PropertyPath... indexableNestedPropertyPaths)
Adds one or more property paths for indexing from the nested document property.
Parameters | |
---|---|
indexableNestedPropertyPaths |
PropertyPath : This value cannot be null . |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |
See also:
addIndexableNestedPropertyPaths
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths (Collection<PropertyPath> indexableNestedPropertyPaths)
Adds one or more property paths for indexing from the nested document property.
Parameters | |
---|---|
indexableNestedPropertyPaths |
Collection : This value cannot be null . |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |
See also:
build
public AppSearchSchema.DocumentPropertyConfig build ()
Constructs a new PropertyConfig
from the contents of this builder.
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if the provided PropertyConfig sets AppSearchSchema.DocumentPropertyConfig.shouldIndexNestedProperties() to true and has one or more properties defined
using addIndexableNestedProperties(java.util.Collection) . |
setCardinality
public AppSearchSchema.DocumentPropertyConfig.Builder setCardinality (int cardinality)
Sets the cardinality of the property (whether it is optional, required or repeated).
If this method is not called, the default cardinality is AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL
.
Parameters | |
---|---|
cardinality |
int : Value is AppSearchSchema.PropertyConfig.CARDINALITY_REPEATED , AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL , or AppSearchSchema.PropertyConfig.CARDINALITY_REQUIRED |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |
setShouldIndexNestedProperties
public AppSearchSchema.DocumentPropertyConfig.Builder setShouldIndexNestedProperties (boolean indexNestedProperties)
Configures whether properties in the nested document should be indexed according to that document's schema.
If false, the nested document's properties are not indexed regardless of its own schema.
To index a subset of properties from the nested document, set this to false and
use addIndexableNestedProperties(java.util.Collection)
.
Parameters | |
---|---|
indexNestedProperties |
boolean |
Returns | |
---|---|
AppSearchSchema.DocumentPropertyConfig.Builder |
This value cannot be null . |