Document.DocumentProperty

public static abstract @interface Document.DocumentProperty
implements Annotation

androidx.appsearch.annotation.Document.DocumentProperty


Configures a member field of a class as a property known to AppSearch.

Field's data class is required to be annotated with Document.

Summary

Public methods

boolean indexNestedProperties()

Configures whether fields in the nested document should be indexed.

String name()

The name of this property.

boolean required()

Configures whether this property must be specified for the document to be valid.

Inherited methods

Public methods

indexNestedProperties

public boolean indexNestedProperties ()

Configures whether fields in the nested document should be indexed.

If false, the nested document's properties are not indexed regardless of its own schema.

Returns
boolean

name

public String name ()

The name of this property. This string is used to query against this property.

If not specified, the name of the field in the code will be used instead.

Returns
String

required

public boolean required ()

Configures whether this property must be specified for the document to be valid.

This attribute does not apply to properties of a repeated type (e.g. a list).

Please make sure you understand the consequences of required fields on schema migration before setting this attribute to true.

Returns
boolean