Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#lfields) \| [Methods](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#inhmethods)

# SearchResult.MatchInfo

*** ** * ** ***

` public static final class SearchResult.MatchInfo `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.SearchResult.MatchInfo |

<br />

*** ** * ** ***

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

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

## Summary

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

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: 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)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo>` | `https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo#CREATOR` <br /> |

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

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Fields

### CREATOR

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

```
public static final Creator<SearchResult.MatchInfo> CREATOR
```

<br />

<br />

## Public methods

### describeContents

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

```
public int describeContents ()
```

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/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | 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/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getEmbeddingMatch

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in [T Extensions 18](https://developer.android.com/sdkExtensions)

```
public SearchResult.EmbeddingMatchInfo getEmbeddingMatch ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchResult.EmbeddingMatchInfo` | A `https://developer.android.com/reference/android/app/appsearch/SearchResult.EmbeddingMatchInfo` instance, or null if the match is not an embedding match. <br /> |

### getExactMatch

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

```
public CharSequence getExactMatch ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | This value cannot be `null`. <br /> |

### getExactMatchRange

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

```
public SearchResult.MatchRange getExactMatchRange ()
```

Gets the `https://developer.android.com/reference/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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. <br /> |

### getFullText

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

```
public String getFullText ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

### getPropertyPath

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

```
public String getPropertyPath ()
```

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"

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

### getPropertyPathObject

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

```
public PropertyPath getPropertyPathObject ()
```

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

Methods such as `https://developer.android.com/reference/android/app/appsearch/GenericDocument#getPropertyDocument(java.lang.String)` accept a path as a string rather than a `https://developer.android.com/reference/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/android/app/appsearch/PropertyPath` rather than a String for easier path manipulation, which can then be converted to a String.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/PropertyPath` | This value cannot be `null`. <br /> |

**See also:**

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

### getSnippet

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

```
public CharSequence getSnippet ()
```

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/android/app/appsearch/SearchSpec.Builder#setMaxSnippetSize(int)`. Windowing is centered around the middle of the matched token with content on either side clipped to token boundaries.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | This value cannot be `null`. <br /> |

### getSnippetRange

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

```
public SearchResult.MatchRange getSnippetRange ()
```

Gets the snippet `https://developer.android.com/reference/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/android/app/appsearch/SearchSpec.Builder#setMaxSnippetSize(int)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. <br /> |

### getSubmatch

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

```
public CharSequence getSubmatch ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | This value cannot be `null`. <br /> |

### getSubmatchRange

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

```
public SearchResult.MatchRange getSubmatchRange ()
```

Gets the `https://developer.android.com/reference/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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchRange` | This value cannot be `null`. <br /> |

### getTextMatch

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in [T Extensions 18](https://developer.android.com/sdkExtensions)

```
public SearchResult.TextMatchInfo getTextMatch ()
```

Retrieves the text-based match information.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchResult.TextMatchInfo` | A `https://developer.android.com/reference/android/app/appsearch/SearchResult.TextMatchInfo` instance, or null if the match is not text-based. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |