EmbeddingMatchInfo


class EmbeddingMatchInfo : Parcelable
kotlin.Any
   ↳ android.app.appsearch.SearchResult.EmbeddingMatchInfo

This class represents match objects for any snippets that might be present in SearchResults from an embedding query. Using this class, you can get:

  • the semantic score of the matching vector with the embedding query
  • the query embedding vector index - the index of the query EmbeddingVector in the list returned by SearchSpec.getEmbeddingParameters()
  • the embedding search metric type for the corresponding query
for each vector match in the document.

Summary

Inherited constants
Public constructors
EmbeddingMatchInfo(semanticScore: Double, queryEmbeddingVectorIndex: Int, embeddingSearchMetricType: Int)

Creates a new immutable EmbeddingMatchInfo.

Public methods
Int

Gets the embedding search metric type that this embedding match corresponds to.

Int

Gets the index of the query vector that this embedding match corresponds to.

Double

Gets the semantic score corresponding to the embedding match.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<SearchResult.EmbeddingMatchInfo!>

Public constructors

EmbeddingMatchInfo

EmbeddingMatchInfo(
    semanticScore: Double,
    queryEmbeddingVectorIndex: Int,
    embeddingSearchMetricType: Int)

Creates a new immutable EmbeddingMatchInfo.

Parameters
semanticScore Double: the semantic score of the embedding match against the query vector.
queryEmbeddingVectorIndex Int: the index of the matched query embedding vector in SearchSpec.getEmbeddingParameters()
embeddingSearchMetricType Int: the search metric type used to calculate the score for the match and the query vector Value is android.app.appsearch.SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT, android.app.appsearch.SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_COSINE, android.app.appsearch.SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT, or android.app.appsearch.SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN

Public methods

getQueryEmbeddingVectorIndex

fun getQueryEmbeddingVectorIndex(): Int

Gets the index of the query vector that this embedding match corresponds to. This is the index of the query EmbeddingVector in the list returned by android.app.appsearch.SearchSpec#getEmbeddingParameters()

getSemanticScore

fun getSemanticScore(): Double

Gets the semantic score corresponding to the embedding match.

writeToParcel

fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties