# SearchResult.MatchInfo.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo.Builder "View this page in Java")  

```
class Builder
```

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

Builder for[MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo)objects.

## Summary

|                                                                                                                                                                                                         Public constructors                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#Builder(kotlin.String))`(`propertyPath:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Creates a new[MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#)reporting a match with the given property path. |

|                                                                                                                                                                                                                                                                                                                                Public methods                                                                                                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SearchResult.MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo)                  | [build](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#build())`()` Constructs a new[MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo).                                                                                                                                                                                                                                                                                    |
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | [setEmbeddingMatch](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#setEmbeddingMatch(android.app.appsearch.SearchResult.EmbeddingMatchInfo))`(`embeddingMatch:` `[SearchResult.EmbeddingMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo)?`)` Sets the[EmbeddingMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo)corresponding to the given entry. |
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | [setExactMatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#setExactMatchRange(android.app.appsearch.SearchResult.MatchRange))`(`matchRange:` `[SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)`)` Sets the exact[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.                                      |
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | [setSnippetRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#setSnippetRange(android.app.appsearch.SearchResult.MatchRange))`(`matchRange:` `[SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)`)` Sets the snippet[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.                                          |
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | [setSubmatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#setSubmatchRange(android.app.appsearch.SearchResult.MatchRange))`(`matchRange:` `[SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)`)` Sets the submatch[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.                                       |

## Public constructors

### Builder

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

```
Builder(propertyPath: String)
```

Creates a new[MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#)reporting a match with the given property path.

A property path is a dot-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".

|                                                                                                                   Parameters                                                                                                                    ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `propertyPath` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):A dot-delimited sequence of property names indicating which property in the document these snippets correspond to. This value cannot be`null`. |

## Public methods

### build

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

```
fun build(): SearchResult.MatchInfo
```

Constructs a new[MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo).

|                                                                       Return                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SearchResult.MatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo) | This value cannot be`null`. |

### setEmbeddingMatch

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 setEmbeddingMatch(embeddingMatch: SearchResult.EmbeddingMatchInfo?): SearchResult.MatchInfo.Builder
```

Sets the[EmbeddingMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo)corresponding to the given entry.

|                                                                                     Parameters                                                                                      ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `embeddingMatch` | [SearchResult.EmbeddingMatchInfo](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.EmbeddingMatchInfo)?:This value may be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | This value cannot be`null`. |

### setExactMatchRange

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

```
fun setExactMatchRange(matchRange: SearchResult.MatchRange): SearchResult.MatchInfo.Builder
```

Sets the exact[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.

|                                                                            Parameters                                                                             ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `matchRange` | [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange):This value cannot be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | This value cannot be`null`. |

### setSnippetRange

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

```
fun setSnippetRange(matchRange: SearchResult.MatchRange): SearchResult.MatchInfo.Builder
```

Sets the snippet[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.

|                                                                            Parameters                                                                             ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `matchRange` | [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange):This value cannot be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | This value cannot be`null`. |

### setSubmatchRange

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 setSubmatchRange(matchRange: SearchResult.MatchRange): SearchResult.MatchInfo.Builder
```

Sets the submatch[MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange)corresponding to the given entry.

|                                                                            Parameters                                                                             ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `matchRange` | [SearchResult.MatchRange](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchRange):This value cannot be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SearchResult.MatchInfo.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult.MatchInfo.Builder#) | This value cannot be`null`. |