AppSearchSchema.EmbeddingPropertyConfig.Builder


public static final class AppSearchSchema.EmbeddingPropertyConfig.Builder
extends Object

java.lang.Object
   ↳ android.app.appsearch.AppSearchSchema.EmbeddingPropertyConfig.Builder


Builder for EmbeddingPropertyConfig.

Summary

Public constructors

Builder(String propertyName)

Creates a new EmbeddingPropertyConfig.Builder.

Public methods

AppSearchSchema.EmbeddingPropertyConfig build()

Constructs a new EmbeddingPropertyConfig from the contents of this builder.

AppSearchSchema.EmbeddingPropertyConfig.Builder setCardinality(int cardinality)

Sets the cardinality of the property (whether it is optional, required or repeated).

AppSearchSchema.EmbeddingPropertyConfig.Builder setIndexingType(int indexingType)

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

AppSearchSchema.EmbeddingPropertyConfig.Builder setQuantizationType(int quantizationType)

Configures whether the vector contents of this property should be quantized.

Inherited methods

Public constructors

Builder

Added in T Extensions 16
public Builder (String propertyName)

Creates a new EmbeddingPropertyConfig.Builder.

Parameters
propertyName String: This value cannot be null.

Public methods

build

Added in T Extensions 16
public AppSearchSchema.EmbeddingPropertyConfig build ()

Constructs a new EmbeddingPropertyConfig from the contents of this builder.

Returns
AppSearchSchema.EmbeddingPropertyConfig This value cannot be null.

setCardinality

Added in T Extensions 16
public AppSearchSchema.EmbeddingPropertyConfig.Builder setCardinality (int cardinality)

Sets the cardinality of the property (whether it is optional, required or repeated).

If this method is not called, the default cardinality is AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL.

Parameters
cardinality int: Value is AppSearchSchema.PropertyConfig.CARDINALITY_REPEATED, AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL, or AppSearchSchema.PropertyConfig.CARDINALITY_REQUIRED

Returns
AppSearchSchema.EmbeddingPropertyConfig.Builder This value cannot be null.

setIndexingType

Added in T Extensions 16
public AppSearchSchema.EmbeddingPropertyConfig.Builder setIndexingType (int indexingType)

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

If this method is not called, the default indexing type is AppSearchSchema.EmbeddingPropertyConfig.INDEXING_TYPE_NONE, so that it will not be indexed and cannot be matched by queries.

Parameters
indexingType int: Value is AppSearchSchema.EmbeddingPropertyConfig.INDEXING_TYPE_NONE, or AppSearchSchema.EmbeddingPropertyConfig.INDEXING_TYPE_SIMILARITY

Returns
AppSearchSchema.EmbeddingPropertyConfig.Builder This value cannot be null.

setQuantizationType

public AppSearchSchema.EmbeddingPropertyConfig.Builder setQuantizationType (int quantizationType)

Configures whether the vector contents of this property should be quantized.

Quantization can reduce the size of the embedding search index, potentially leading to faster embedding search due to lower I/O bandwidth. Quantization is usually very reliable and in most cases will have a negligible impact on recall. Using quantization is strongly recommended.

If this method is not called, the default quantization type is AppSearchSchema.EmbeddingPropertyConfig.QUANTIZATION_TYPE_NONE.

Parameters
quantizationType int: Value is AppSearchSchema.EmbeddingPropertyConfig.QUANTIZATION_TYPE_NONE, or AppSearchSchema.EmbeddingPropertyConfig.QUANTIZATION_TYPE_8_BIT

Returns
AppSearchSchema.EmbeddingPropertyConfig.Builder This value cannot be null.