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 |
|---|
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_BLOB_HANDLE)Configuration for a property of type |
public final class AppSearchSchema.BlobHandlePropertyConfig.BuilderBuilder for |
public final class AppSearchSchema.BooleanPropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property containing a boolean. |
public final class AppSearchSchema.BooleanPropertyConfig.BuilderBuilder for |
public final class AppSearchSchema.BuilderBuilder for |
public final class AppSearchSchema.BytesPropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property containing a byte array. |
public final class AppSearchSchema.BytesPropertyConfig.BuilderBuilder for |
public final class AppSearchSchema.DocumentPropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property containing another Document. |
public final class AppSearchSchema.DocumentPropertyConfig.BuilderBuilder for |
public final class AppSearchSchema.DoublePropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property containing a double-precision decimal number. |
public final class AppSearchSchema.DoublePropertyConfig.BuilderBuilder for |
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_EMBEDDING_PROPERTY_CONFIG)Configuration for a property of type |
public final class AppSearchSchema.EmbeddingPropertyConfig.BuilderBuilder for |
public final class AppSearchSchema.LongPropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property containing a 64-bit integer. |
public final class AppSearchSchema.LongPropertyConfig.BuilderBuilder for |
public abstract class AppSearchSchema.PropertyConfigCommon configuration for a single property (field) in a Document. |
public final class AppSearchSchema.StringPropertyConfig extends AppSearchSchema.PropertyConfigConfiguration for a property of type String in a Document. |
public final class AppSearchSchema.StringPropertyConfig.BuilderBuilder for |
Public methods |
|
|---|---|
boolean |
|
static @NonNull AppSearchSchema |
@ExperimentalAppSearchApiGets the generated |
@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 |
@NonNull String |
Returns the name of this schema type, such as Email. |
int |
hashCode() |
@NonNull String |
toString() |
Public methods
fromDocumentClass
@ExperimentalAppSearchApi
public static @NonNull AppSearchSchema fromDocumentClass(@NonNull Class<@NonNull ?> documentClass)
Gets the generated AppSearchSchema for a class annotated with \@androidx.appsearch.annotation.Document.
| Parameters | |
|---|---|
@NonNull Class<@NonNull ?> documentClass |
A class annotated with \@ |
| Returns | |
|---|---|
@NonNull AppSearchSchema |
the generated |
| Throws | |
|---|---|
androidx.appsearch.exceptions.AppSearchException |
if no generated conversion class exists on the classpath for the given document class. |
getDescription
@ExperimentalAppSearchApi
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
public @NonNull List<String> getParentTypes()
Returns the list of parent types of this schema for polymorphism.
getProperties
public @NonNull List<AppSearchSchema.PropertyConfig> getProperties()
Returns the list of PropertyConfigs that are part of this schema.
This method creates a new list when called.
getSchemaType
public @NonNull String getSchemaType()
Returns the name of this schema type, such as Email.