# SetSchemaRequest.Builder

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/SetSchemaRequest.java+class:androidx.appsearch.app.SetSchemaRequest.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
public final class SetSchemaRequest.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` objects.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#Builder()()` Creates a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder`. |
| `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#Builder(androidx.appsearch.app.SetSchemaRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest request)` Creates a `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` from the given `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addDocumentClassVisibleToConfig(java.lang.Class<?>,androidx.appsearch.app.SchemaVisibilityConfig)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig schemaVisibilityConfig )` Sets the documents from the provided `schemaType` can be read by the caller if they match the ALL visibility requirements set in `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addDocumentClasses(java.lang.Class<?>...)(@https://developer.android.com/reference/androidx/annotation/NonNull Class[] documentClasses)` Adds one or more `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated classes to the schema. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addDocumentClasses(java.util.Collection<? extends java.lang.Class<?>>)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> documentClasses)` Adds a collection of `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated classes to the schema. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.ADD_PERMISSIONS_AND_GET_VISIBILITY) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addRequiredPermissionsForDocumentClassVisibility(java.lang.Class<?>,java.util.Set<java.lang.Integer>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/Integer.html> permissions )` Adds a set of required Android `https://developer.android.com/reference/android/Manifest.permission.html` combination to the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.ADD_PERMISSIONS_AND_GET_VISIBILITY) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addRequiredPermissionsForSchemaTypeVisibility(java.lang.String,java.util.Set<java.lang.Integer>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/Integer.html> permissions )` Adds a set of required Android `https://developer.android.com/reference/android/Manifest.permission.html` combination to the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemaTypeVisibleToConfig(java.lang.String,androidx.appsearch.app.SchemaVisibilityConfig)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig schemaVisibilityConfig )` Sets the documents from the provided `schemaType` can be read by the caller if they match the ALL visibility requirements set in `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemas(androidx.appsearch.app.AppSearchSchema...)(@https://developer.android.com/reference/androidx/annotation/NonNull AppSearchSchema[] schemas)` Adds one or more `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` types to the schema. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemas(java.util.Collection<androidx.appsearch.app.AppSearchSchema>)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema> schemas)` Adds a collection of `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` objects to the schema. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#build()()` Builds a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` object. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearDocumentClassVisibleToConfigs(java.lang.Class<?>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass )` Clears all visible to `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` for the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearMigrators()()` Clears all `https://developer.android.com/reference/androidx/appsearch/app/Migrator`s. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.ADD_PERMISSIONS_AND_GET_VISIBILITY) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearRequiredPermissionsForDocumentClassVisibility(java.lang.Class<?>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass )` Clears all required permissions combinations for the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.ADD_PERMISSIONS_AND_GET_VISIBILITY) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearRequiredPermissionsForSchemaTypeVisibility(java.lang.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType )` Clears all required permissions combinations for the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearSchemaTypeVisibleToConfigs(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType)` Clears all visible to `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` for the given schema type. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#clearSchemas()()` Clears all `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema`s from the list of schemas. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setDocumentClassDisplayedBySystem(java.lang.Class<?>,boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, boolean displayed )` Sets whether or not documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class will be displayed and visible on any system UI surface. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setDocumentClassVisibilityForPackage(java.lang.Class<?>,boolean,androidx.appsearch.app.PackageIdentifier)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, boolean visible, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier )` Sets whether or not documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class can be read by the specified package. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_SET_WIPEOUT_ACCOUNT) @https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setDocumentClassWipeoutAccountPropertyPaths(java.lang.Class<?>,java.util.Set<androidx.appsearch.app.PropertyPath>,boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/appsearch/app/PropertyPath> accountPropertyPaths, boolean autoWipeOut )` Configures the property paths within a specific schema type that are associated with a account, enabling AppSearch to automatically wipe out `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s when that account is removed. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setForceOverride(boolean)(boolean forceOverride)` Sets whether or not to override the current schema in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` database. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setMigrator(java.lang.String,androidx.appsearch.app.Migrator)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/Migrator migrator)` Sets the `https://developer.android.com/reference/androidx/appsearch/app/Migrator` associated with the given SchemaType. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setMigrators(java.util.Map<java.lang.String,androidx.appsearch.app.Migrator>)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/appsearch/app/Migrator> migrators)` Sets a Map of `https://developer.android.com/reference/androidx/appsearch/app/Migrator`s. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setPubliclyVisibleDocumentClass(java.lang.Class<?>,androidx.appsearch.app.PackageIdentifier)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier )` Specify that the documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class should be publicly available, to packages which already have visibility to `packageIdentifier`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE) https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setPubliclyVisibleSchema(java.lang.String,androidx.appsearch.app.PackageIdentifier)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schema, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier )` Specify that the schema should be publicly available, to packages which already have visibility to `packageIdentifier`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setSchemaTypeDisplayedBySystem(java.lang.String,boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, boolean displayed )` Sets whether or not documents from the provided `schemaType` will be displayed and visible on any system UI surface. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage(java.lang.String,boolean,androidx.appsearch.app.PackageIdentifier)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, boolean visible, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier )` Sets whether or not documents from the provided `schemaType` can be read by the specified package. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SET_SCHEMA_REQUEST_SET_WIPEOUT_ACCOUNT) @https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setSchemaTypeWipeoutAccountPropertyPaths(java.lang.String,java.util.Set<androidx.appsearch.app.PropertyPath>,boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/appsearch/app/PropertyPath> accountPropertyPaths, boolean autoWipeout )` Configures the property paths within a specific schema type that are associated with a account, enabling AppSearch to automatically wipe out `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s when that account is removed. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int version)` Sets the version number of the overall `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` in the database. |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public Builder()
```

Creates a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder`.

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
public Builder(@NonNull SetSchemaRequest request)
```

Creates a `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` from the given `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`.

## Public methods

### addDocumentClassVisibleToConfig

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG)
public @NonNull SetSchemaRequest.Builder addDocumentClassVisibleToConfig(
    @NonNull Class<@NonNull ?> documentClass,
    @NonNull SchemaVisibilityConfig schemaVisibilityConfig
)
```

Sets the documents from the provided `schemaType` can be read by the caller if they match the ALL visibility requirements set in `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`.

The requirements in a `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` is "AND" relationship. A caller must match ALL requirements to access the schema. For example, a caller must hold required permissions AND it is a specified package.

You can call this method repeatedly to add multiple `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`s, and the querier will have access if they match ANY of the `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | A class annotated with `https://developer.android.com/reference/androidx/appsearch/annotation/Document`, the visibility of which will be configured |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig schemaVisibilityConfig` | The `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` holds all requirements that a call must to match to access the schema. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

### addDocumentClasses

```
public @NonNull SetSchemaRequest.Builder addDocumentClasses(@NonNull Class[] documentClasses)
```

Adds one or more `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated classes to the schema.

Merged list available from `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#getSchemas()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Class[] documentClasses` | classes annotated with `https://developer.android.com/reference/androidx/appsearch/annotation/Document`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` | if `androidx.appsearch.compiler.AppSearchCompiler` has not generated a schema for the given document classes. |

### addDocumentClasses

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder addDocumentClasses(@NonNull Collection<Class<@NonNull ?>> documentClasses)
```

Adds a collection of `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated classes to the schema.

This will also add all `https://developer.android.com/reference/androidx/appsearch/annotation/Document` classes referenced by the schema via document properties.

Merged list available from `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#getSchemas()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> documentClasses` | classes annotated with `https://developer.android.com/reference/androidx/appsearch/annotation/Document`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` | if `androidx.appsearch.compiler.AppSearchCompiler` has not generated a schema for the given document classes. |

### addRequiredPermissionsForDocumentClassVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.ADD_PERMISSIONS_AND_GET_VISIBILITY)
public @NonNull SetSchemaRequest.Builder addRequiredPermissionsForDocumentClassVisibility(
    @NonNull Class<@NonNull ?> documentClass,
    @NonNull Set<Integer> permissions
)
```

Adds a set of required Android `https://developer.android.com/reference/android/Manifest.permission.html` combination to the given schema type.

If the querier holds ALL of the required permissions in this combination, they will have access to read `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` objects of the given schema type.

You can call this method to add multiple permission combinations, and the querier will have access if they holds ANY of the combinations.

The supported Permissions are `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_SMS()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_CALENDAR()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_CONTACTS()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_EXTERNAL_STORAGE()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_HOME_APP_SEARCH_DATA()` and `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_ASSISTANT_APP_SEARCH_DATA()`.

The relationship between visible packages added in this method and permission visibility setting `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addRequiredPermissionsForSchemaTypeVisibility(java.lang.String,java.util.Set<java.lang.Integer>)` is "OR". The caller could access the schema if they match ANY requirements. If you want to set "AND" requirements like a caller must hold required permissions AND it is a specified package, please use `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemaTypeVisibleToConfig(java.lang.String,androidx.appsearch.app.SchemaVisibilityConfig)`.

Merged map available from `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#getRequiredPermissionsForSchemaTypeVisibility()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | The `https://developer.android.com/reference/androidx/appsearch/annotation/Document` class to set visibility on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/Integer.html> permissions` | A set of required Android permissions the caller need to hold to access `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` objects that under the given schema. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | -- if input unsupported permission. |
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_SMS` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_CALENDAR` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_CONTACTS` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_HOME_APP_SEARCH_DATA` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_ASSISTANT_APP_SEARCH_DATA` |   |

### addRequiredPermissionsForSchemaTypeVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.ADD_PERMISSIONS_AND_GET_VISIBILITY)
public @NonNull SetSchemaRequest.Builder addRequiredPermissionsForSchemaTypeVisibility(
    @NonNull String schemaType,
    @NonNull Set<Integer> permissions
)
```

Adds a set of required Android `https://developer.android.com/reference/android/Manifest.permission.html` combination to the given schema type.

If the querier holds ALL of the required permissions in this combination, they will have access to read `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` objects of the given schema type.

You can call this method to add multiple permission combinations, and the querier will have access if they holds ANY of the combinations.

The supported Permissions are `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_SMS()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_CALENDAR()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_CONTACTS()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_EXTERNAL_STORAGE()`, `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_HOME_APP_SEARCH_DATA()` and `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#READ_ASSISTANT_APP_SEARCH_DATA()`.

The relationship between permissions added in this method and package visibility setting `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage(java.lang.String,boolean,androidx.appsearch.app.PackageIdentifier)` is "OR". The caller could access the schema if they match ANY requirements. If you want to set "AND" requirements like a caller must hold required permissions AND it is a specified package, please use `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemaTypeVisibleToConfig(java.lang.String,androidx.appsearch.app.SchemaVisibilityConfig)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The schema type to set visibility on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/Integer.html> permissions` | A set of required Android permissions the caller need to hold to access `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` objects that under the given schema. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | -- if input unsupported permission. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_SMS` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_CALENDAR` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_CONTACTS` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_HOME_APP_SEARCH_DATA` |   |
| `https://developer.android.com/reference/android/Manifest.permission.html#READ_ASSISTANT_APP_SEARCH_DATA` |   |

### addSchemaTypeVisibleToConfig

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG)
public @NonNull SetSchemaRequest.Builder addSchemaTypeVisibleToConfig(
    @NonNull String schemaType,
    @NonNull SchemaVisibilityConfig schemaVisibilityConfig
)
```

Sets the documents from the provided `schemaType` can be read by the caller if they match the ALL visibility requirements set in `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`.

The requirements in a `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` is "AND" relationship. A caller must match ALL requirements to access the schema. For example, a caller must hold required permissions AND it is a specified package.

You can call this method repeatedly to add multiple `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`s, and the querier will have access if they match ANY of the `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The schema type to set visibility on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig schemaVisibilityConfig` | The `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` holds all requirements that a call must to match to access the schema. |

### addSchemas

```
public @NonNull SetSchemaRequest.Builder addSchemas(@NonNull AppSearchSchema[] schemas)
```

Adds one or more `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` types to the schema.

An `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` object represents one type of structured data.

Any documents of these types will be displayed on system UI surfaces by default.

### addSchemas

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder addSchemas(@NonNull Collection<AppSearchSchema> schemas)
```

Adds a collection of `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` objects to the schema.

An `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` object represents one type of structured data.

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest build()
```

Builds a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` object.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if schema types were referenced, but the corresponding `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` type was never added. |

### clearDocumentClassVisibleToConfigs

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG)
public @NonNull SetSchemaRequest.Builder clearDocumentClassVisibleToConfigs(
    @NonNull Class<@NonNull ?> documentClass
)
```

Clears all visible to `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` for the given schema type.

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

### clearMigrators

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
public @NonNull SetSchemaRequest.Builder clearMigrators()
```

Clears all `https://developer.android.com/reference/androidx/appsearch/app/Migrator`s.

### clearRequiredPermissionsForDocumentClassVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.ADD_PERMISSIONS_AND_GET_VISIBILITY)
public @NonNull SetSchemaRequest.Builder clearRequiredPermissionsForDocumentClassVisibility(
    @NonNull Class<@NonNull ?> documentClass
)
```

Clears all required permissions combinations for the given schema type.

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

### clearRequiredPermissionsForSchemaTypeVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.ADD_PERMISSIONS_AND_GET_VISIBILITY)
public @NonNull SetSchemaRequest.Builder clearRequiredPermissionsForSchemaTypeVisibility(
    @NonNull String schemaType
)
```

Clears all required permissions combinations for the given schema type.

### clearSchemaTypeVisibleToConfigs

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG)
public @NonNull SetSchemaRequest.Builder clearSchemaTypeVisibleToConfigs(@NonNull String schemaType)
```

Clears all visible to `https://developer.android.com/reference/androidx/appsearch/app/SchemaVisibilityConfig` for the given schema type.

### clearSchemas

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
public @NonNull SetSchemaRequest.Builder clearSchemas()
```

Clears all `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema`s from the list of schemas.

### setDocumentClassDisplayedBySystem

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setDocumentClassDisplayedBySystem(
    @NonNull Class<@NonNull ?> documentClass,
    boolean displayed
)
```

Sets whether or not documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class will be displayed and visible on any system UI surface.

This setting applies to the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class only, and does not persist across `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` calls.

The default behavior, if this method is not called, is to allow types to be displayed on system UI surfaces.

You can use `https://developer.android.com/reference/androidx/appsearch/app/Features#isFeatureSupported(java.lang.String)` with the `https://developer.android.com/reference/androidx/appsearch/app/Features#SET_SCHEMA_REQUEST_SCHEMA_TYPE_DISPLAYED_BY_SYSTEM()` Feature to see if this visibility mode is supported on this backend / API level combination. If not supported, this function is still safe to call and the configuration will be saved in the schema, but it will not have any effect and documents will not be visible through this mechanism on that backend / API level.

Merged list available from `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#getSchemasNotDisplayedBySystem()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | A class annotated with `https://developer.android.com/reference/androidx/appsearch/annotation/Document`, the visibility of which will be configured |
| `boolean displayed` | Whether documents of this type will be displayed on system UI surfaces. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` | if `androidx.appsearch.compiler.AppSearchCompiler` has not generated a schema for the given document class. |

### setDocumentClassVisibilityForPackage

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setDocumentClassVisibilityForPackage(
    @NonNull Class<@NonNull ?> documentClass,
    boolean visible,
    @NonNull PackageIdentifier packageIdentifier
)
```

Sets whether or not documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class can be read by the specified package.

Each package is represented by a `https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier`, containing a package name and a byte array of type `https://developer.android.com/reference/android/content/pm/PackageManager.html#CERT_INPUT_SHA256`.

To opt into one-way data sharing with another application, the developer will need to explicitly grant the other application's package name and certificate Read access to its data.

For two-way data sharing, both applications need to explicitly grant Read access to one another.

By default, app data sharing between applications is disabled.

The relationship between visible packages added in this method and permission visibility setting `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addRequiredPermissionsForSchemaTypeVisibility(java.lang.String,java.util.Set<java.lang.Integer>)` is "OR". The caller could access the schema if they match ANY requirements. If you want to set "AND" requirements like a caller must hold required permissions AND it is a specified package, please use `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemaTypeVisibleToConfig(java.lang.String,androidx.appsearch.app.SchemaVisibilityConfig)`.

Merged list available from `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest#getSchemasVisibleToPackages()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | The `https://developer.android.com/reference/androidx/appsearch/annotation/Document` class to set visibility on. |
| `boolean visible` | Whether the `documentClass` will be visible or not. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier` | Represents the package that will be granted visibility. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` | if `androidx.appsearch.compiler.AppSearchCompiler` has not generated a schema for the given document class. |

### setDocumentClassWipeoutAccountPropertyPaths

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_SET_WIPEOUT_ACCOUNT)
@ExperimentalAppSearchApi
public @NonNull SetSchemaRequest.Builder setDocumentClassWipeoutAccountPropertyPaths(
    @NonNull Class<@NonNull ?> documentClass,
    @NonNull Set<PropertyPath> accountPropertyPaths,
    boolean autoWipeOut
)
```

Configures the property paths within a specific schema type that are associated with a account, enabling AppSearch to automatically wipe out `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s when that account is removed.

The property path must point to a `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.DocumentPropertyConfig` which is AppSearch built-in account.

When putting a `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` into AppSearch, all accounts identified by the given `accountPropertyPaths` within that document must already exist. AppSearch will reject the document if any account specified by these paths is not recognized.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | the `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class of the schema type being configured (e.g., "Email"). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/appsearch/app/PropertyPath> accountPropertyPaths` | A Set of property paths (e.g., "sender.account") point to the field containing the account identifier. |
| `boolean autoWipeOut` | If `true`, enables automatic account wipeout for the given paths. If `false`, disables it. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | This `Builder` instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `schemaType` or `accountPropertyPaths` is null. |
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

### setForceOverride

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setForceOverride(boolean forceOverride)
```

Sets whether or not to override the current schema in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` database.

Call this method whenever backward incompatible changes need to be made by setting `forceOverride` to `true`. As a result, during execution of the setSchema operation, all documents that are incompatible with the new schema will be deleted and the new schema will be saved and persisted.

By default, this is `false`.

### setMigrator

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setMigrator(@NonNull String schemaType, @NonNull Migrator migrator)
```

Sets the `https://developer.android.com/reference/androidx/appsearch/app/Migrator` associated with the given SchemaType.

The `https://developer.android.com/reference/androidx/appsearch/app/Migrator` migrates all `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s under given schema type from the current version number stored in AppSearch to the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)`.

A `https://developer.android.com/reference/androidx/appsearch/app/Migrator` will be invoked if the current version number stored in AppSearch is different from the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)` and `https://developer.android.com/reference/androidx/appsearch/app/Migrator#shouldMigrate(int,int)` returns `true`.

The target schema type of the output `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` of `https://developer.android.com/reference/androidx/appsearch/app/Migrator#onUpgrade(int,int,androidx.appsearch.app.GenericDocument)` or `https://developer.android.com/reference/androidx/appsearch/app/Migrator#onDowngrade(int,int,androidx.appsearch.app.GenericDocument)` must exist in this `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The schema type to set migrator on. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/Migrator migrator` | The migrator translates a document from its current version to the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemas(androidx.appsearch.app.AppSearchSchema...)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |

### setMigrators

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setMigrators(@NonNull Map<String, Migrator> migrators)
```

Sets a Map of `https://developer.android.com/reference/androidx/appsearch/app/Migrator`s.

The key of the map is the schema type that the `https://developer.android.com/reference/androidx/appsearch/app/Migrator` value applies to.

The `https://developer.android.com/reference/androidx/appsearch/app/Migrator` migrates all `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s under given schema type from the current version number stored in AppSearch to the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)`.

A `https://developer.android.com/reference/androidx/appsearch/app/Migrator` will be invoked if the current version number stored in AppSearch is different from the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)` and `https://developer.android.com/reference/androidx/appsearch/app/Migrator#shouldMigrate(int,int)` returns `true`.

The target schema type of the output `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` of `https://developer.android.com/reference/androidx/appsearch/app/Migrator#onUpgrade(int,int,androidx.appsearch.app.GenericDocument)` or `https://developer.android.com/reference/androidx/appsearch/app/Migrator#onDowngrade(int,int,androidx.appsearch.app.GenericDocument)` must exist in this `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/appsearch/app/Migrator> migrators` | A `https://developer.android.com/reference/java/util/Map.html` of migrators that translate a document from its current version to the final version set via `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)`. The key of the map is the schema type that the `https://developer.android.com/reference/androidx/appsearch/app/Migrator` value applies to. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setVersion(int)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemas(androidx.appsearch.app.AppSearchSchema...)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |

### setPubliclyVisibleDocumentClass

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE)
public @NonNull SetSchemaRequest.Builder setPubliclyVisibleDocumentClass(
    @NonNull Class<@NonNull ?> documentClass,
    @Nullable PackageIdentifier packageIdentifier
)
```

Specify that the documents from the provided `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class should be publicly available, to packages which already have visibility to `packageIdentifier`. This visibility is determined by the result of `https://developer.android.com/reference/android/content/pm/PackageManager.html#canPackageQuery(java.lang.String, java.lang.String)`.

It is possible for the packageIdentifier parameter to be different from the package performing the indexing. This might happen in the case of an on-device indexer processing information about various packages. The visibility will be the same regardless of which package indexes the document, as the visibility is based on the packageIdentifier parameter.

If this is called repeatedly with the same `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class, the `https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier` in the last call will be used as the "from" package for that class (or schema).

Calling this with packageIdentifier set to null is valid, and will remove public visibility for the class (or schema).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> documentClass` | the `https://developer.android.com/reference/androidx/appsearch/annotation/Document` annotated class to make publicly accessible. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier` | if an app can see this package via PackageManager#canPackageQuery, it will be able to see the documents of type `documentClass`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/exceptions/AppSearchException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setPubliclyVisibleSchema(java.lang.String,androidx.appsearch.app.PackageIdentifier)` |   |

### setPubliclyVisibleSchema

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE)
public @NonNull SetSchemaRequest.Builder setPubliclyVisibleSchema(
    @NonNull String schema,
    @Nullable PackageIdentifier packageIdentifier
)
```

Specify that the schema should be publicly available, to packages which already have visibility to `packageIdentifier`. This visibility is determined by the result of `https://developer.android.com/reference/android/content/pm/PackageManager.html#canPackageQuery(java.lang.String, java.lang.String)`.

It is possible for the packageIdentifier parameter to be different from the package performing the indexing. This might happen in the case of an on-device indexer processing information about various packages. The visibility will be the same regardless of which package indexes the document, as the visibility is based on the packageIdentifier parameter.

If this is called repeatedly with the same schema, the `https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier` in the last call will be used as the "from" package for that schema.

Calling this with packageIdentifier set to null is valid, and will remove public visibility for the schema.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schema` | the schema to make publicly accessible. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier` | if an app can see this package via PackageManager#canPackageQuery, it will be able to see the documents of type `schema`. |

### setSchemaTypeDisplayedBySystem

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setSchemaTypeDisplayedBySystem(
    @NonNull String schemaType,
    boolean displayed
)
```

Sets whether or not documents from the provided `schemaType` will be displayed and visible on any system UI surface.

This setting applies to the provided `schemaType` only, and does not persist across `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` calls.

The default behavior, if this method is not called, is to allow types to be displayed on system UI surfaces.

You can use `https://developer.android.com/reference/androidx/appsearch/app/Features#isFeatureSupported(java.lang.String)` with the `https://developer.android.com/reference/androidx/appsearch/app/Features#SET_SCHEMA_REQUEST_SCHEMA_TYPE_DISPLAYED_BY_SYSTEM()` Feature to see if this visibility mode is supported on this backend / API level combination. If not supported, this function is still safe to call and the configuration will be saved in the schema, but it will not have any effect and documents will not be visible through this mechanism on that backend / API level.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The name of an `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` within the same `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`, which will be configured. |
| `boolean displayed` | Whether documents of this type will be displayed on system UI surfaces. |

### setSchemaTypeVisibilityForPackage

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setSchemaTypeVisibilityForPackage(
    @NonNull String schemaType,
    boolean visible,
    @NonNull PackageIdentifier packageIdentifier
)
```

Sets whether or not documents from the provided `schemaType` can be read by the specified package.

Each package is represented by a `https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier`, containing a package name and a byte array of type `https://developer.android.com/reference/android/content/pm/PackageManager.html#CERT_INPUT_SHA256`.

To opt into one-way data sharing with another application, the developer will need to explicitly grant the other application's package name and certificate Read access to its data.

For two-way data sharing, both applications need to explicitly grant Read access to one another.

By default, data sharing between applications is disabled.

The relationship between permissions added in this method and package visibility setting `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage(java.lang.String,boolean,androidx.appsearch.app.PackageIdentifier)` is "OR". The caller could access the schema if they match ANY requirements. If you want to set "AND" requirements like a caller must hold required permissions AND it is a specified package, please use `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#addSchemaTypeVisibleToConfig(java.lang.String,androidx.appsearch.app.SchemaVisibilityConfig)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The schema type to set visibility on. |
| `boolean visible` | Whether the `schemaType` will be visible or not. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/PackageIdentifier packageIdentifier` | Represents the package that will be granted visibility. |

### setSchemaTypeWipeoutAccountPropertyPaths

Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SET_SCHEMA_REQUEST_SET_WIPEOUT_ACCOUNT)
@ExperimentalAppSearchApi
public @NonNull SetSchemaRequest.Builder setSchemaTypeWipeoutAccountPropertyPaths(
    @NonNull String schemaType,
    @NonNull Set<PropertyPath> accountPropertyPaths,
    boolean autoWipeout
)
```

Configures the property paths within a specific schema type that are associated with a account, enabling AppSearch to automatically wipe out `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s when that account is removed.

To enable AppSearch to automatically wipe out documents when an account is removed, you must use this API to configure the account property paths for the relevant schema type. If this configuration is not set for a schema type, AppSearch will not automatically delete any `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`s of that type, even if the account associated with the document is removed from the system. Documents will only be deleted if the app explicitly calls for their removal.

The property path must point to a `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.DocumentPropertyConfig` which is AppSearch built-in account. The property path could point to the nested document.

When putting a `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` into AppSearch, all accounts identified by the given `accountPropertyPaths` within that document must already exist. AppSearch will reject the document if any account specified by these paths is not recognized.

Subsequent calls for the same `schemaType` are additive. When `autoWipeout` is `true`, new paths are merged into the existing configuration; when `false`, the specified paths are removed. This allows you to incrementally manage multiple account-associated fields within a single schema.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The name of the schema type being configured (e.g., "Email"). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/appsearch/app/PropertyPath> accountPropertyPaths` | A Set of property paths (e.g., "sender.account") point to the field containing the account identifier. |
| `boolean autoWipeout` | If `true`, enables automatic account wipeout for the given paths. If `false`, disables it. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` | This `Builder` instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `schemaType` or `accountPropertyPaths` is null. |

### setVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
public @NonNull SetSchemaRequest.Builder setVersion(@IntRange(from = 1) int version)
```

Sets the version number of the overall `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema` in the database.

The `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` database can only ever hold documents for one version at a time.

Setting a version number that is different from the version number currently stored in AppSearch will result in AppSearch calling the `https://developer.android.com/reference/androidx/appsearch/app/Migrator`s provided to `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` to migrate the documents already in AppSearch from the previous version to the one set in this request. The version number can be updated without any other changes to the set of schemas.

The version number can stay the same, increase, or decrease relative to the current version number that is already stored in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` database.

The version of an empty database will always be 0. You cannot set version to the `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest`, if it doesn't contains any `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int version` | A positive integer representing the version of the entire set of schemas represents the version of the whole schema in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` database, default version is 1. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the version is negative. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/Migrator` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setMigrator(java.lang.String,androidx.appsearch.app.Migrator)` |   |