Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#inhmethods)

# SearchResult.Builder

*** ** * ** ***

` public static final class SearchResult.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/android/app/appsearch/SearchResult` objects.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#Builder(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/java/lang/String databaseName) ` Constructs a new builder for `https://developer.android.com/reference/android/app/appsearch/SearchResult` objects. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#addInformationalRankingSignal(double)(double rankingSignal) ` Adds the informational ranking signal of the matched document in this SearchResult. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#addJoinedResult(android.app.appsearch.SearchResult)(https://developer.android.com/reference/android/app/appsearch/SearchResult joinedResult) ` Adds a `https://developer.android.com/reference/android/app/appsearch/SearchResult` that was joined by the `https://developer.android.com/reference/android/app/appsearch/JoinSpec`. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#addMatchInfo(android.app.appsearch.SearchResult.MatchInfo)(https://developer.android.com/reference/android/app/appsearch/SearchResult.MatchInfo matchInfo) ` Adds another match to this SearchResult. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#build()() ` Constructs a new `https://developer.android.com/reference/android/app/appsearch/SearchResult`. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#setGenericDocument(android.app.appsearch.GenericDocument)(https://developer.android.com/reference/android/app/appsearch/GenericDocument document) ` Sets the document which matched. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#setParentTypeMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>>)(https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>> parentTypeMap) ` Sets the map from schema type names to the list of their parent types. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchResult.Builder#setRankingSignal(double)(double rankingSignal) ` Sets the ranking signal of the matched document in this SearchResult. |

### 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*.

## Public constructors

### Builder

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

```
public Builder (String packageName, 
                String databaseName)
```

Constructs a new builder for `https://developer.android.com/reference/android/app/appsearch/SearchResult` objects.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: the package name the matched document belongs to. This value cannot be `null`. <br /> |
| `databaseName` | `String`: the database name the matched document belongs to. This value cannot be `null`. <br /> |

## Public methods

### addInformationalRankingSignal

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

```
public SearchResult.Builder addInformationalRankingSignal (double rankingSignal)
```

Adds the informational ranking signal of the matched document in this SearchResult.

<br />

| Parameters ||
|---|---|
| `rankingSignal` | `double` <br /> |

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

### addJoinedResult

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 SearchResult.Builder addJoinedResult (SearchResult joinedResult)
```

Adds a `https://developer.android.com/reference/android/app/appsearch/SearchResult` that was joined by the `https://developer.android.com/reference/android/app/appsearch/JoinSpec`.

<br />

| Parameters ||
|---|---|
| `joinedResult` | `SearchResult`: The joined SearchResult to add. This value cannot be `null`. <br /> |

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

### addMatchInfo

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

```
public SearchResult.Builder addMatchInfo (SearchResult.MatchInfo matchInfo)
```

Adds another match to this SearchResult.

<br />

| Parameters ||
|---|---|
| `matchInfo` | `SearchResult.MatchInfo`: This value cannot be `null`. <br /> |

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

### build

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

```
public SearchResult build ()
```

Constructs a new `https://developer.android.com/reference/android/app/appsearch/SearchResult`.

<br />

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

### setGenericDocument

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

```
public SearchResult.Builder setGenericDocument (GenericDocument document)
```

Sets the document which matched.

<br />

| Parameters ||
|---|---|
| `document` | `GenericDocument`: This value cannot be `null`. <br /> |

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

### setParentTypeMap

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

```
public SearchResult.Builder setParentTypeMap (Map<String, List<String>> parentTypeMap)
```

Sets the map from schema type names to the list of their parent types.

The map should include entries for the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`'s own type and all of the nested documents' types.

Child types must appear before parent types in each list. Otherwise, the GenericDocument's toDocumentClass method (an AndroidX-only API) may not correctly identify the most concrete type. This could lead to unintended deserialization into a more general type instead of a more specific type.

Parent types should include transitive parents.

<br />

| Parameters ||
|---|---|
| `parentTypeMap` | `Map`: This value cannot be `null`. <br /> |

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

### setRankingSignal

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

```
public SearchResult.Builder setRankingSignal (double rankingSignal)
```

Sets the ranking signal of the matched document in this SearchResult.

<br />

| Parameters ||
|---|---|
| `rankingSignal` | `double` <br /> |

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