AppSearchSchema


public final class AppSearchSchema


The AppSearch Schema for a particular type of document.

For example, an e-mail message or a music recording could be a schema type.

The schema consists of type information, properties, and config (like tokenization type).

See also
setSchemaAsync

Summary

Nested types

Configuration for a property containing a boolean.

Builder for BooleanPropertyConfig.

public final class AppSearchSchema.Builder

Builder for objects.

Configuration for a property containing a byte array.

Builder for BytesPropertyConfig.

Configuration for a property containing another Document.

Builder for DocumentPropertyConfig.

Configuration for a property containing a double-precision decimal number.

Builder for DoublePropertyConfig.

@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_EMBEDDING_PROPERTY_CONFIG)
public final class AppSearchSchema.EmbeddingPropertyConfig extends AppSearchSchema.PropertyConfig

Configuration for a property of type EmbeddingVector in a Document.

Builder for EmbeddingPropertyConfig.

Configuration for a property containing a 64-bit integer.

Builder for LongPropertyConfig.

public abstract class AppSearchSchema.PropertyConfig

Common configuration for a single property (field) in a Document.

Configuration for a property of type String in a Document.

Builder for StringPropertyConfig.

Public methods

boolean
@NonNull String

Returns a natural language description of this schema type.

@NonNull List<String>

Returns the list of parent types of this schema for polymorphism.

@NonNull List<AppSearchSchema.PropertyConfig>

Returns the list of PropertyConfigs that are part of this schema.

@NonNull String

Returns the name of this schema type, such as Email.

int
@NonNull String

Public methods

equals

public boolean equals(@Nullable Object other)

getDescription

Added in 1.1.0-alpha06
public @NonNull String getDescription()

Returns a natural language description of this schema type.

Ex. The description for an Email type could be "A type of electronic message".

This information is purely to help apps consuming this type to understand its semantic meaning. This field has no effect in AppSearch - it is just stored with the AppSearchSchema. If setDescription is uncalled, then this method will return an empty string.

getParentTypes

Added in 1.1.0-alpha06
public @NonNull List<StringgetParentTypes()

Returns the list of parent types of this schema for polymorphism.

getProperties

Added in 1.1.0-alpha06
public @NonNull List<AppSearchSchema.PropertyConfiggetProperties()

Returns the list of PropertyConfigs that are part of this schema.

This method creates a new list when called.

getSchemaType

Added in 1.1.0-alpha06
public @NonNull String getSchemaType()

Returns the name of this schema type, such as Email.

hashCode

public int hashCode()

toString

public @NonNull String toString()