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

# SearchSuggestionSpec.Builder

*** ** * ** ***

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

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

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#Builder(int)(int maximumResultCount) ` Creates an `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` object. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterDocumentIds(java.lang.String,%20java.lang.String[])(https://developer.android.com/reference/java/lang/String namespace, https://developer.android.com/reference/java/lang/String documentIds) ` Adds a document ID filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterDocumentIds(java.lang.String,%20java.util.Collection<java.lang.String>)(https://developer.android.com/reference/java/lang/String namespace, https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String> documentIds) ` Adds a document ID filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterNamespaces(java.util.Collection<java.lang.String>)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String> namespaces) ` Adds a namespace filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterNamespaces(java.lang.String[])(https://developer.android.com/reference/java/lang/String namespaces) ` Adds a namespace filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterProperties(java.lang.String,%20java.util.Collection<java.lang.String>)(https://developer.android.com/reference/java/lang/String schema, https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String> propertyPaths) ` Adds property paths for the specified type to the property filter of `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterPropertyPaths(java.lang.String,%20java.util.Collection<android.app.appsearch.PropertyPath>)(https://developer.android.com/reference/java/lang/String schema, https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/app/appsearch/PropertyPath> propertyPaths) ` Adds property paths for the specified type to the property filter of `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterSchemas(java.lang.String[])(https://developer.android.com/reference/java/lang/String schemaTypes) ` Adds a schema filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addFilterSchemas(java.util.Collection<java.lang.String>)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String> schemaTypes) ` Adds a schema filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addSearchStringParameters(java.lang.String[])(https://developer.android.com/reference/java/lang/String searchStringParameters) ` Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#addSearchStringParameters(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> searchStringParameters) ` Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#build()() ` Constructs a new `https://developer.android.com/reference/android/app/appsearch/SearchSpec` from the contents of this builder. |
| ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | ` https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder#setRankingStrategy(int)(int rankingStrategy) ` Sets ranking strategy for suggestion results. |

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

```
public Builder (int maximumResultCount)
```

Creates an `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` object.

<br />

| Parameters ||
|---|---|
| `maximumResultCount` | `int`: Sets the maximum number of suggestion in the returned object. Value is 1 or greater <br /> |

## Public methods

### addFilterDocumentIds

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 SearchSuggestionSpec.Builder addFilterDocumentIds (String namespace, 
                String... documentIds)
```

Adds a document ID filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

<br />

| Parameters ||
|---|---|
| `namespace` | `String`: This value cannot be `null`. <br /> |
| `documentIds` | `String`: This value cannot be `null`. <br /> |

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

### addFilterDocumentIds

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 SearchSuggestionSpec.Builder addFilterDocumentIds (String namespace, 
                Collection<String> documentIds)
```

Adds a document ID filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

<br />

| Parameters ||
|---|---|
| `namespace` | `String`: This value cannot be `null`. <br /> |
| `documentIds` | `Collection`: This value cannot be `null`. <br /> |

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

### addFilterNamespaces

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 SearchSuggestionSpec.Builder addFilterNamespaces (Collection<String> namespaces)
```

Adds a namespace filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

<br />

| Parameters ||
|---|---|
| `namespaces` | `Collection`: This value cannot be `null`. <br /> |

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

### addFilterNamespaces

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 SearchSuggestionSpec.Builder addFilterNamespaces (String... namespaces)
```

Adds a namespace filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

<br />

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

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

### addFilterProperties

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 SearchSuggestionSpec.Builder addFilterProperties (String schema, 
                Collection<String> propertyPaths)
```

Adds property paths for the specified type to the property filter of `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has content under the specified property. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type.

If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

Example properties: 'body', 'sender.name', 'sender.emailaddress', etc.

<br />

| Parameters ||
|---|---|
| `schema` | `String`: the `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema` that contains the target properties. This value cannot be `null`. <br /> |
| `propertyPaths` | `Collection`: The String version of `https://developer.android.com/reference/android/app/appsearch/PropertyPath`. A dot-delimited sequence of property names indicating which property in the document these snippets correspond to. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | <br /> |

### addFilterPropertyPaths

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 SearchSuggestionSpec.Builder addFilterPropertyPaths (String schema, 
                Collection<PropertyPath> propertyPaths)
```

Adds property paths for the specified type to the property filter of `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has content under the specified property. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type.

If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

<br />

| Parameters ||
|---|---|
| `schema` | `String`: the `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema` that contains the target properties. This value cannot be `null`. <br /> |
| `propertyPaths` | `Collection`: The `https://developer.android.com/reference/android/app/appsearch/PropertyPath` to search suggestion over. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec.Builder` | <br /> |

### addFilterSchemas

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 SearchSuggestionSpec.Builder addFilterSchemas (String... schemaTypes)
```

Adds a schema filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

<br />

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

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

### addFilterSchemas

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 SearchSuggestionSpec.Builder addFilterSchemas (Collection<String> schemaTypes)
```

Adds a schema filter to `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec` Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

<br />

| Parameters ||
|---|---|
| `schemaTypes` | `Collection`: This value cannot be `null`. <br /> |

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

### addSearchStringParameters

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 SearchSuggestionSpec.Builder addSearchStringParameters (String... searchStringParameters)
```

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

<br />

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

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

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec)`

### addSearchStringParameters

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 SearchSuggestionSpec.Builder addSearchStringParameters (List<String> searchStringParameters)
```

Adds Strings to the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

<br />

| Parameters ||
|---|---|
| `searchStringParameters` | `List`: This value cannot be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec)`

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

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

<br />

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

### setRankingStrategy

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 SearchSuggestionSpec.Builder setRankingStrategy (int rankingStrategy)
```

Sets ranking strategy for suggestion results.

The default value `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT` will be used if this method is never called.

<br />

| Parameters ||
|---|---|
| `rankingStrategy` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_NONE` - `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT` - `https://developer.android.com/reference/android/app/appsearch/SearchSuggestionSpec#SUGGESTION_RANKING_STRATEGY_TERM_FREQUENCY` |

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