SearchResult.EmbeddingMatchInfo


public static final class SearchResult.EmbeddingMatchInfo
extends Object implements Parcelable

java.lang.Object
   ↳ 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

Fields

public static final Creator<SearchResult.EmbeddingMatchInfo> CREATOR

Public constructors

EmbeddingMatchInfo(double semanticScore, int queryEmbeddingVectorIndex, int embeddingSearchMetricType)

Creates a new immutable EmbeddingMatchInfo.

Public methods

int getEmbeddingSearchMetricType()

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

int getQueryEmbeddingVectorIndex()

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

double getSemanticScore()

Gets the semantic score corresponding to the embedding match.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

Added in T Extensions 18
public static final Creator<SearchResult.EmbeddingMatchInfo> CREATOR

Public constructors

EmbeddingMatchInfo

Added in T Extensions 18
public EmbeddingMatchInfo (double semanticScore, 
                int queryEmbeddingVectorIndex, 
                int embeddingSearchMetricType)

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 SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT, SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_COSINE, SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT, or SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN

Public methods

getEmbeddingSearchMetricType

Added in T Extensions 18
public int getEmbeddingSearchMetricType ()

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

Returns
int Value is SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT, SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_COSINE, SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT, or SearchSpec.EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN

getQueryEmbeddingVectorIndex

Added in T Extensions 18
public int getQueryEmbeddingVectorIndex ()

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 SearchSpec.getEmbeddingParameters()

Returns
int

getSemanticScore

Added in T Extensions 18
public double getSemanticScore ()

Gets the semantic score corresponding to the embedding match.

Returns
double

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

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.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES