# Class Suggestions

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.suggest.Suggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md)

This is the base class for suggestions containers.
For each type of items, a sub class provides methods to
access the actual items.

See the sub classes for more specific information.

## All Known Subclasses

[BrandSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.BrandSuggestions.md), [CategorySuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CategorySuggestions.md), [ContentSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ContentSuggestions.md), [CustomSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.CustomSuggestions.md), [ProductSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.ProductSuggestions.md)

## Property Summary

| Property                                                                                                                                                                                  | Description                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [searchPhraseSuggestions](#searchphrasesuggestions): [SearchPhraseSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md) `(read-only)` | Returns the suggested search phrases that are associated to this suggestions.                                                                                                   |
| ~~[suggestedPhrases](#suggestedphrases): [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`                                            | Returns a list of [SuggestedPhrase](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the  user input search phrase. |
| ~~[suggestedTerms](#suggestedterms): [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`                                                | Returns a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects.                                                 |

## Constructor Summary

This class does not have a constructor, so you cannot create it directly.

## Method Summary

| Method                                                                                                                                     | Description                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [getSearchPhraseSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions)() | Returns the suggested search phrases that are associated to this suggestions.                                                                                                   |
| ~~[getSuggestedPhrases](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedphrases)()~~           | Returns a list of [SuggestedPhrase](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the  user input search phrase. |
| ~~[getSuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms)()~~               | Returns a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects.                                                 |
| ~~[hasSuggestedPhrases](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)()~~           | Returns whether this suggestions container has any suggested phrases.                                                                                                           |
| ~~[hasSuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedterms)()~~               | Returns whether this suggestions container has any suggested terms.                                                                                                             |
| [hasSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestions)()                         | Returns whether this suggestions container has any suggested items, i.e.                                                                                                        |

### Methods inherited from class Object

[assign](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)

## Property Details

### searchPhraseSuggestions

- searchPhraseSuggestions: [SearchPhraseSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md) `(read-only)`
  - : Returns the suggested search phrases that are associated to this suggestions.

    In contrast to the suggested items, the suggested phrases contains the corrected and
    completed versions of the original search phrase.

***

### suggestedPhrases

- ~~suggestedPhrases: [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`
  - : Returns a list of [SuggestedPhrase](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the
    user input search phrase.

    **See Also:**

    - [hasSuggestedPhrases()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

### suggestedTerms

- ~~suggestedTerms: [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~ `(read-only)`
  - : Returns a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. Each of the returned
    instances represents a set of terms suggested for a particular single term
    of the user input search phrase.

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

## Method Details

### getSearchPhraseSuggestions()

- getSearchPhraseSuggestions(): [SearchPhraseSuggestions](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SearchPhraseSuggestions.md)
  - : Returns the suggested search phrases that are associated to this suggestions.

    In contrast to the suggested items, the suggested phrases contains the corrected and
    completed versions of the original search phrase.

    **Returns:**

    - the suggested search phrases for this suggestions

***

### getSuggestedPhrases()

- ~~getSuggestedPhrases(): [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~
  - : Returns a list of [SuggestedPhrase](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md) objects that relates to the
    user input search phrase.

    **Returns:**

    - a list of [SuggestedPhrase](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedPhrase.md)s

    **See Also:**

    - [hasSuggestedPhrases()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#hassuggestedphrases)

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

### getSuggestedTerms()

- ~~getSuggestedTerms(): [Iterator](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Iterator.md)~~
  - : Returns a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) objects. Each of the returned
    instances represents a set of terms suggested for a particular single term
    of the user input search phrase.

    **Returns:**

    - a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md) for each term of the user input search phrase

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

### hasSuggestedPhrases()

- ~~hasSuggestedPhrases(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
  - : Returns whether this suggestions container has any suggested phrases.

    Note that this method only looks for suggested phrases. It does not account
    for suggested terms or suggested objects. In other words,
    even if there are suggested terms or objects, this method
    will return false if this suggestions container has no phrases.

    **Returns:**

    - true only if there are phrases available

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

### hasSuggestedTerms()

- ~~hasSuggestedTerms(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)~~
  - : Returns whether this suggestions container has any suggested terms.

    Note that this method checks suggested terms only,
    but not suggested phrases or suggested objects.

    **Returns:**

    - true only if there are terms available

    **Deprecated:**

:::warning
Please use method [getSearchPhraseSuggestions()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsearchphrasesuggestions) to obtain the suggested search phrases.
:::

***

### hasSuggestions()

- hasSuggestions(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns whether this suggestions container has any suggested items, i.e. products.

    Note that this method only looks for concrete suggested items. It does not account
    for suggested terms. In other words, even if there are suggested terms, this method
    will return false if no matching items, like products or categories, were found
    for the suggested terms.

    To find out whether there are suggested terms and how they match with respect to
    the original search phrase, one can use [getSuggestedTerms()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms) to obtain
    a list of [SuggestedTerms](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md).

    **Returns:**

    - true only if there are items found using the suggested terms

    **See Also:**

    - [getSuggestedTerms()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.Suggestions.md#getsuggestedterms)
    - [SuggestedTerms.isEmpty()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.suggest.SuggestedTerms.md#isempty)

***
