# QueryExpansionSpec

- [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#SCHEMA_REPRESENTATION)
- [Condition](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#Condition)

Specification to determine under which conditions query expansion should occur.

| JSON representation |
|---|
| ``` { "condition": enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#Condition`), "pinUnexpandedResults": boolean } ``` |

| Fields ||
|---|---|
| `condition` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#Condition`)`` The condition under which query expansion should occur. Default to `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#Condition.ENUM_VALUES.DISABLED`. |
| `pinUnexpandedResults` | `boolean` Whether to pin unexpanded results. If this field is set to true, unexpanded products are always at the top of the search results, followed by the expanded results. |

## Condition

Enum describing under which condition query expansion should occur.

| Enums ||
|---|---|
| `CONDITION_UNSPECIFIED` | Unspecified query expansion condition. In this case, server behavior defaults to `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/QueryExpansionSpec#Condition.ENUM_VALUES.DISABLED`. |
| `DISABLED` | Disabled query expansion. Only the exact search query is used, even if `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/SearchResponse#FIELDS.total_size` is zero. |
| `AUTO` | Automatic query expansion built by the Search API. |