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) Summary: [Ctors](https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#inhmethods)

# JoinSpec.Builder

*** ** * ** ***

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

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

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#Builder(android.app.appsearch.JoinSpec)(https://developer.android.com/reference/android/app/appsearch/JoinSpec joinSpec) ` Creates a new `https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` from the given `https://developer.android.com/reference/android/app/appsearch/JoinSpec`. |
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#Builder(java.lang.String)(https://developer.android.com/reference/java/lang/String childPropertyExpression) ` Create a specification for the joining operation in search. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec` | ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#build()() ` Constructs a new `https://developer.android.com/reference/android/app/appsearch/JoinSpec` from the contents of this builder. |
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#setAggregationScoringStrategy(int)(int aggregationScoringStrategy) ` Sets how we derive a single score from a list of joined documents. |
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#setChildPropertyExpression(java.lang.String)(https://developer.android.com/reference/java/lang/String childPropertyExpression) ` Sets the child property expression. |
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#setMaxJoinedResultCount(int)(int maxJoinedResultCount) ` Sets the max amount of `https://developer.android.com/reference/android/app/appsearch/SearchResults` to return with the parent document, with a default of 10 SearchResults. |
| ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#setNestedSearch(java.lang.String,%20android.app.appsearch.SearchSpec)(https://developer.android.com/reference/java/lang/String nestedQuery, https://developer.android.com/reference/android/app/appsearch/SearchSpec nestedSearchSpec) ` Sets the query and the SearchSpec for the documents being joined. |

### 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 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [T Extensions 7](https://developer.android.com/sdkExtensions)

```
public Builder (JoinSpec joinSpec)
```

Creates a new `https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder` from the given `https://developer.android.com/reference/android/app/appsearch/JoinSpec`.

<br />

| Parameters ||
|---|---|
| `joinSpec` | `JoinSpec`: This value cannot be `null`. <br /> |

### Builder

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 Builder (String childPropertyExpression)
```

Create a specification for the joining operation in search.

The child property expression specifies how to join documents. Documents with a child property expression equal to the qualified id of the parent will be retrieved.

Property expressions differ from `https://developer.android.com/reference/android/app/appsearch/PropertyPath` as property expressions may refer to document properties or nested document properties such as "person.business.id" as well as a property expression. Currently the only property expression is "this.qualifiedId()". `https://developer.android.com/reference/android/app/appsearch/PropertyPath` objects may only reference document properties and nested document properties.

In order to join a child document to a parent document, the child document must contain the parent's qualified id at the property expression specified by this method.

<br />

| Parameters ||
|---|---|
| `childPropertyExpression` | `String`: the property to match in the child documents. This value cannot be `null`. <br /> |

## Public methods

### build

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 JoinSpec build ()
```

Constructs a new `https://developer.android.com/reference/android/app/appsearch/JoinSpec` from the contents of this builder.

<br />

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

### setAggregationScoringStrategy

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 JoinSpec.Builder setAggregationScoringStrategy (int aggregationScoringStrategy)
```

Sets how we derive a single score from a list of joined documents.

The default scoring strategy is `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL`, which specifies that the ranking signal of the outer parent document will be used.

<br />

| Parameters ||
|---|---|
| `aggregationScoringStrategy` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL` - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_RESULT_COUNT` - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_MIN_RANKING_SIGNAL` - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_AVG_RANKING_SIGNAL` - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_MAX_RANKING_SIGNAL` - `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_SUM_RANKING_SIGNAL` |

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

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE`

### setChildPropertyExpression

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 JoinSpec.Builder setChildPropertyExpression (String childPropertyExpression)
```

Sets the child property expression.

The child property expression specifies how to join documents. Documents with a child property expression equal to the qualified id of the parent will be retrieved.

Property expressions differ from `https://developer.android.com/reference/android/app/appsearch/PropertyPath` as property expressions may refer to document properties or nested document properties such as "person.business.id" as well as a property expression. Currently the only property expression is "this.qualifiedId()". `https://developer.android.com/reference/android/app/appsearch/PropertyPath` objects may only reference document properties and nested document properties.

In order to join a child document to a parent document, the child document must contain the parent's qualified id at the property expression specified by this method.

<br />

| Parameters ||
|---|---|
| `childPropertyExpression` | `String`: the property to match in the child documents. This value cannot be `null`. <br /> |

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

### setMaxJoinedResultCount

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 JoinSpec.Builder setMaxJoinedResultCount (int maxJoinedResultCount)
```

Sets the max amount of `https://developer.android.com/reference/android/app/appsearch/SearchResults` to return with the parent document, with a default of 10 SearchResults.

This does NOT limit the number of results that are joined with the parent document for scoring. This means that, when set, only a maximum of `maxJoinedResultCount` results will be returned with each parent document, but all results that are joined with a parent will factor into the score.

<br />

| Parameters ||
|---|---|
| `maxJoinedResultCount` | `int` <br /> |

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

### setNestedSearch

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 JoinSpec.Builder setNestedSearch (String nestedQuery, 
                SearchSpec nestedSearchSpec)
```

Sets the query and the SearchSpec for the documents being joined. This will score and rank the joined documents as well as filter the joined documents.

If `https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE` is set in the outer `https://developer.android.com/reference/android/app/appsearch/SearchSpec`, the resulting signals will be used to rank the parent documents. Note that the aggregation strategy also needs to be set with `https://developer.android.com/reference/android/app/appsearch/JoinSpec.Builder#setAggregationScoringStrategy(int)`, otherwise the default will be `https://developer.android.com/reference/android/app/appsearch/JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL`, which will just use the parent documents ranking signal.

If this method is never called, `https://developer.android.com/reference/android/app/appsearch/JoinSpec#getNestedQuery()` will return an empty string, meaning we will join with every possible document that matches the equality constraints and hasn't been filtered out by the type or namespace filters.

<br />

| Parameters ||
|---|---|
| `nestedQuery` | `String`: This value cannot be `null`. <br /> |
| `nestedSearchSpec` | `SearchSpec`: This value cannot be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/JoinSpec#getNestedQuery()`
- `https://developer.android.com/reference/android/app/appsearch/JoinSpec#getNestedSearchSpec()`