# SearchResult.EmbeddingMatchInfo

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/SearchResult.java+class:androidx.appsearch.app.SearchResult.EmbeddingMatchInfo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
@ExperimentalAppSearchApi
class SearchResult.EmbeddingMatchInfo
```

<br />

*** ** * ** ***

This class represents match objects for any snippets that might be present in `https://developer.android.com/reference/kotlin/androidx/appsearch/app/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 `https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector` in the list returned by `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec#getEmbeddingParameters()`
- the embedding search metric type for the corresponding query

for each vector match in the document.

## Summary

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult.EmbeddingMatchInfo#EmbeddingMatchInfo(double,int,int)( semanticScore: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, queryEmbeddingVectorIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, embeddingSearchMetricType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates a new immutable EmbeddingMatchInfo. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult.EmbeddingMatchInfo#getEmbeddingSearchMetricType()()` Gets the embedding search metric type that this embedding match corresponds to. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult.EmbeddingMatchInfo#getQueryEmbeddingVectorIndex()()` Gets the index of the query vector that this embedding match corresponds to. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult.EmbeddingMatchInfo#getSemanticScore()()` Gets the semantic score corresponding to the embedding match. |

## Public constructors

### EmbeddingMatchInfo

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
EmbeddingMatchInfo(
    semanticScore: Double,
    queryEmbeddingVectorIndex: Int,
    embeddingSearchMetricType: Int
)
```

Creates a new immutable EmbeddingMatchInfo.

| Parameters |
|---|---|
| `semanticScore: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the semantic score of the embedding match against the query vector. |
| `queryEmbeddingVectorIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the index of the matched query embedding vector in `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec#getEmbeddingParameters()` |
| `embeddingSearchMetricType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the search metric type used to calculate the score for the match and the query vector |

## Public functions

### getEmbeddingSearchMetricType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
fun getEmbeddingSearchMetricType(): Int
```

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

### getQueryEmbeddingVectorIndex

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
fun getQueryEmbeddingVectorIndex(): Int
```

Gets the index of the query vector that this embedding match corresponds to. This is the index of the query `https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector` in the list returned by `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec#getEmbeddingParameters()`

### getSemanticScore

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
@ExperimentalAppSearchApi
fun getSemanticScore(): Double
```

Gets the semantic score corresponding to the embedding match.