Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# MatchInfo

*** ** * ** ***

```
class MatchInfo : Parcelable
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.appsearch.SearchResult.MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#) |

This class represents match objects for any snippets that might be present in `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResults` from a query.

A `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#` contains either a `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.TextMatchInfo` representing a text match snippet, or an `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo` representing an embedding match snippet.

## Summary

| Nested classes ||
|---|---|
|   | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder` Builder for `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#` objects. |

| Inherited constants ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` Descriptor bit used with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` Flag for use with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

| Public methods ||
|---|---|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#describeContents()()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| [SearchResult.EmbeddingMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo)? | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getEmbeddingMatch()()` Retrieves the embedding-based match information. |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getExactMatch()()` Gets the exact term of the given entry that matched the query. |
| [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getExactMatchRange()()` Gets the `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` of the exact term of the given entry that matched the query. |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getFullText()()` Gets the full text corresponding to the given entry. |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getPropertyPath()()` Gets the property path corresponding to the given entry. |
| [PropertyPath](https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getPropertyPathObject()()` Gets a `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath` object representing the property path corresponding to the given entry. |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getSnippet()()` Gets the snippet corresponding to the given entry. |
| [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getSnippetRange()()` Gets the snippet `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` corresponding to the given entry. |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getSubmatch()()` Gets the exact term subsequence of the given entry that matched the query. |
| [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getSubmatchRange()()` Gets the `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` of the submatch term subsequence of the given entry that matched the query. |
| [SearchResult.TextMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.TextMatchInfo)? | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getTextMatch()()` Retrieves the text-based match information. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#writeToParcel(android.os.Parcel,%20kotlin.Int)(dest: https://developer.android.com/reference/kotlin/android/os/Parcel.html#, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Flatten this object in to a Parcel. |

| Properties ||
|---|---|
| static [Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[SearchResult.MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#)!\> | `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#CREATOR:android.os.Parcelable.Creator` <br /> |

## Public methods

### describeContents

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun describeContents(): Int
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`, the return value of this method must include the `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` bit.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` |

### getEmbeddingMatch

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 18](https://developer.android.com/sdkExtensions)

```
fun getEmbeddingMatch(): SearchResult.EmbeddingMatchInfo?
```

Retrieves the embedding-based match information. Only populated when `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec#shouldRetrieveEmbeddingMatchInfos()` is true.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo?` | A `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo` instance, or null if the match is not an embedding match. |

### getExactMatch

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getExactMatch(): CharSequence
```

Gets the exact term of the given entry that matched the query. Returns an empty CharSequence if the match is not text-based.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html` | This value cannot be `null`. |

### getExactMatchRange

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getExactMatchRange(): SearchResult.MatchRange
```

Gets the `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` of the exact term of the given entry that matched the query. Returns \[0, 0\] if the match is not text-based.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. |

### getFullText

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getFullText(): String
```

Gets the full text corresponding to the given entry. Returns an empty string if the match is not text-based.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | This value cannot be `null`. |

### getPropertyPath

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getPropertyPath(): String
```

Gets the property path corresponding to the given entry.

A property path is a '.' - delimited sequence of property names indicating which property in the document these snippets correspond to.

Example properties: 'body', 'sender.name', 'sender.emailaddress', etc. For class example 1 this returns "subject"

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | This value cannot be `null`. |

### getPropertyPathObject

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 7](https://developer.android.com/sdkExtensions)

```
fun getPropertyPathObject(): PropertyPath
```

Gets a `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath` object representing the property path corresponding to the given entry.

Methods such as `https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument#getPropertyDocument(kotlin.String)` accept a path as a string rather than a `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath` object. However, you may want to manipulate the path before getting a property document. This method returns a `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath` rather than a String for easier path manipulation, which can then be converted to a String.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo#getPropertyPath()`
- `https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath`

### getSnippet

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getSnippet(): CharSequence
```

Gets the snippet corresponding to the given entry. Returns an empty CharSequence if the match is not text-based.

Snippet - Provides a subset of the content to display. Only populated when requested maxSnippetSize \> 0. The size of this content can be changed by `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec.Builder#setMaxSnippetSize(kotlin.Int)`. Windowing is centered around the middle of the matched token with content on either side clipped to token boundaries.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html` | This value cannot be `null`. |

### getSnippetRange

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getSnippetRange(): SearchResult.MatchRange
```

Gets the snippet `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` corresponding to the given entry. Returns \[0,0\] if the match is not text-based.

Only populated when set maxSnippetSize \> 0 in `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec.Builder#setMaxSnippetSize(kotlin.Int)`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. |

### getSubmatch

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 3](https://developer.android.com/sdkExtensions)

```
fun getSubmatch(): CharSequence
```

Gets the exact term subsequence of the given entry that matched the query. Returns an empty CharSequence if the match is not text-based.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html` | This value cannot be `null`. |

### getSubmatchRange

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 3](https://developer.android.com/sdkExtensions)

```
fun getSubmatchRange(): SearchResult.MatchRange
```

Gets the `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` of the submatch term subsequence of the given entry that matched the query. Returns \[0, 0\] if the match is not text-based.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. |

### getTextMatch

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 18](https://developer.android.com/sdkExtensions)

```
fun getTextMatch(): SearchResult.TextMatchInfo?
```

Retrieves the text-based match information.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.TextMatchInfo?` | A `https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.TextMatchInfo` instance, or null if the match is not text-based. |

### writeToParcel

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

Flatten this object in to a Parcel.

| Parameters ||
|---|---|
| `dest` | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#): This value cannot be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` |

## Properties

### CREATOR

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [T Extensions 13](https://developer.android.com/sdkExtensions)

```
static val CREATOR: Parcelable.Creator<SearchResult.MatchInfo!>
```