Document.StringProperty

public static abstract @interface Document.StringProperty
implements Annotation

androidx.appsearch.annotation.Document.StringProperty


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

Summary

Public methods

int indexingType()

Configures how a property should be indexed so that it can be retrieved by queries.

String name()

The name of this property.

boolean required()

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

int tokenizerType()

Configures how tokens should be extracted from this property.

Inherited methods

Public methods

indexingType

public int indexingType ()

Configures how a property should be indexed so that it can be retrieved by queries.

If not specified, defaults to AppSearchSchema.StringPropertyConfig.INDEXING_TYPE_NONE (the field will not be indexed and cannot be queried). TODO(b/171857731) renamed to TermMatchType when using String-specific indexing config.

Returns
int

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

tokenizerType

public int tokenizerType ()

Configures how tokens should be extracted from this property.

If not specified, defaults to AppSearchSchema.StringPropertyConfig.TOKENIZER_TYPE_PLAIN (the field will be tokenized along word boundaries as plain text).

Returns
int