Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShopperDiscoverySearch

Einstein-powered product search and search suggestions.

Example with shopper auth

import { Discovery, ClientConfig, Customer, slasHelpers } from "commerce-sdk";
// or
const { Discovery, ClientConfig, Customer, slasHelpers } = require("commerce-sdk");

const clientConfig: ClientConfig = {
  parameters: {
    clientId: "XXXXXX",
    organizationId: "XXXX",
    shortCode: "XXX",
    siteId: "XX"
  }
};

// must be registered in SLAS. On server, redirectURI is never called
const redirectURI = "http://localhost:3000/callback";
const slasClient = new Customer.ShopperLogin(clientConfig);
token = await slasHelpers.loginGuestUser(slasClient, { redirectURI });

clientConfig.headers['authorization'] = `Bearer ${token.access_token}`;
const shopperDiscoverySearchClient = new Discovery.ShopperDiscoverySearch(clientConfig);
API Version: 1.1.6
Last Updated:
beta

Hierarchy

  • BaseClient
    • ShopperDiscoverySearch

Index

Type aliases

Static AsyncCreated

AsyncCreated: {}

Type declaration

Static AttributeGrouping

AttributeGrouping: { attributeId: string; groupType: string; returnedAttributes?: Array<string> }

Type declaration

  • attributeId: string
  • groupType: string
  • Optional returnedAttributes?: Array<string>

Static AttributeSorting

AttributeSorting: { attributeId: string; direction: string; sortType: string }

Type declaration

  • attributeId: string
  • direction: string
  • sortType: string

Static AttributesQuery

AttributesQuery: { correctableAttributes?: CorrectableAttributes; highlighting?: Highlighting; queryType: string; value: { attributes: Array<string>; phrase: string } & {} }

Type declaration

  • Optional correctableAttributes?: CorrectableAttributes
  • Optional highlighting?: Highlighting
  • queryType: string
  • value: { attributes: Array<string>; phrase: string } & {}

Static AuthenticationFailure

AuthenticationFailure: {}

Type declaration

Static AuthorizationFailure

AuthorizationFailure: {}

Type declaration

Static BadRequest

BadRequest: {}

Type declaration

Static BaseError

BaseError: { detail?: string; instance?: string; title?: string; type: string }

Type declaration

  • Optional detail?: string
  • Optional instance?: string
  • Optional title?: string
  • type: string

Static BoolFilter

BoolFilter: { filters?: Array<any>; operator: string } & {}

Static BoolQuery

BoolQuery: { must?: Array<any>; mustNot?: Array<any>; should?: Array<any> } & {}

Static ClosedObject

ClosedObject: {} & {}

Static CommonErrors

CommonErrors: {}

Type declaration

Static CorrectableAttributes

CorrectableAttributes: { attributes: Array<string> } & {}

Static DateConditionalRequest

DateConditionalRequest: {}

Type declaration

Static ErrorResponse

ErrorResponse: { detail?: string; instance?: string; title?: string; type: string } & {}

Static EtagConditionalRequest

EtagConditionalRequest: {}

Type declaration

Static EtagResponse

EtagResponse: {}

Type declaration

Static ExpansionAttribute

ExpansionAttribute: { attributeId: string; path: string; value: any } & {}

Static FacetInput

FacetInput: { attributeId: string; facetType: string } & {}

Static FacetOutput

FacetOutput: { attributeId: string; facetType: string } & {}

Static FacetRequest

FacetRequest: { facetLimit?: any; facets?: Array<FacetInput> } & {}

Static Filter

Filter: { boolFilter?: BoolFilter; queryFilter?: QueryFilter; range2Filter?: Range2Filter; rangeFilter?: RangeFilter; termFilter?: TermFilter } & {}

Static Filterable

Filterable: {}

Type declaration

Static FilteredQuery

FilteredQuery: { filter: any; query: any } & {}

Static Grouping

Grouping: { groupType: string } & {}

Static Highlight

Highlight: { attributeId: string; value: string } & {}

Static Highlighting

Highlighting: { attributes: Array<string> } & {}

Static InternalServerError

InternalServerError: {}

Type declaration

Static InvalidRequest

InvalidRequest: {}

Type declaration

Static ItemReference

ItemReference: { attributes?: Array<ExpansionAttribute>; itemId: string } & {}

Static MatchAllQuery

MatchAllQuery: {} & {}

Static Money

Money: { currencyMnemonic?: string; value?: number } & {}

Static MoneyMnemonic

MoneyMnemonic: { currencyMnemonic?: string; value?: number } & {}

Static NestedQuery

NestedQuery: { path: string; query: any; scoreMode?: string } & {}

Static NoPropertiesAllowed

NoPropertiesAllowed: {}

Type declaration

Static NonReadableHttpMessage

NonReadableHttpMessage: {}

Type declaration

Static NotFound

NotFound: {}

Type declaration

Static OffsetPaginated

OffsetPaginated: {}

Type declaration

Static OpenObject

OpenObject: {} & {}

Static PaginatedSearchResult

PaginatedSearchResult: { hits?: Array<object>; limit: number; offset: any; query: any; sorts?: Array<Sort>; total: any } & {}

Static PaginatedSearchResultBase

PaginatedSearchResultBase: { hits?: Array<object>; limit: number; offset: any; query: any; sorts?: Array<Sort>; total: any } & {}

Static Pagination

Pagination: { next?: Self; prev?: Self; self: Self }

Type declaration

Static PaginationLinks

PaginationLinks: { next?: Self; prev?: Self; self: Self } & {}

Static PhraseQuery

PhraseQuery: { correctableAttributes?: CorrectableAttributes; highlighting?: Highlighting; queryType: string; value: string }

Type declaration

Static Query

Query: { boolQuery?: BoolQuery; filteredQuery?: FilteredQuery; matchAllQuery?: MatchAllQuery; nestedQuery?: NestedQuery; termQuery?: TermQuery; textQuery?: TextQuery } & {}

Static QueryFilter

QueryFilter: { query: any } & {}

Static QueryInput

QueryInput: { facetRequest?: FacetRequest; facets?: Array<FacetInput>; grouping?: Grouping; query?: Query; refinements?: Array<Refinement>; returnedAttributes?: Array<string>; sorting: Sorting }

Type declaration

Static QueryOutput

QueryOutput: { facets?: Array<FacetOutput>; hits: Array<Result>; limit: number; links: PaginationLinks; offset: any; total: any }

Type declaration

Static QueryParamsLimit

QueryParamsLimit: {}

Type declaration

Static QueryParamsOffset

QueryParamsOffset: {}

Type declaration

Static Range2Filter

Range2Filter: { filterMode?: string; fromField: string; fromInclusive?: boolean; fromValue?: any; toField: string; toInclusive?: boolean; toValue?: any } & {}

Static RangeFacetInput

RangeFacetInput: {}

Type declaration

Static RangeFacetOutput

RangeFacetOutput: { attributeId: string; facetType: string; max: any; min: any }

Type declaration

  • attributeId: string
  • facetType: string
  • max: any
  • min: any

Static RangeFilter

RangeFilter: { field: string; from?: any; fromInclusive?: boolean; to?: any; toInclusive?: boolean } & {}

Static RangeRefinement

RangeRefinement: { attributeId: string; max: any; min: any; refinementType: string }

Type declaration

  • attributeId: string
  • max: any
  • min: any
  • refinementType: string

Static RateLimitExceeded

RateLimitExceeded: { detail?: string; instance?: string; requestLimit: any; title?: string; type: string }

Type declaration

  • Optional detail?: string
  • Optional instance?: string
  • requestLimit: any
  • Optional title?: string
  • type: string

Static RateLimited

RateLimited: {}

Type declaration

Static RateLimited2

RateLimited2: {}

Type declaration

Static RateLimited3

RateLimited3: {}

Type declaration

Static RateLimited4

RateLimited4: {}

Type declaration

Static RateLimited5

RateLimited5: {}

Type declaration

Static Refinement

Refinement: { attributeId: string; refinementType: string } & {}

Static RelevanceSorting

RelevanceSorting: {}

Type declaration

Static ResourceBadRequest

ResourceBadRequest: {}

Type declaration

  • [key: string]: any

Static ResourceCommonErrors

ResourceCommonErrors: {}

Type declaration

Static ResourceInvalidRequest

ResourceInvalidRequest: {}

Type declaration

Static ResourceLink

ResourceLink: { self: Self } & {}

Static ResourceNonReadableHttpMessage

ResourceNonReadableHttpMessage: {}

Type declaration

Static Result

Result: { groupId?: string; groupedItems?: Array<ItemReference>; highlights?: Array<Highlight>; matchedItem: ItemReference; totalGroupedItems?: any }

Type declaration

Static SearchRequest

SearchRequest: { limit?: number; offset?: any; query: any; sorts?: Array<Sort> } & {}

Static SearchRequestBase

SearchRequestBase: { limit?: number; offset?: any; query: any; sorts?: Array<Sort> } & {}

Static Self

Self: { href: string }

Type declaration

  • href: string

Static SelfResourceLink

SelfResourceLink: { self: Self }

Type declaration

Static ServiceUnavailable

ServiceUnavailable: {}

Type declaration

Static SimpleSearchResult

SimpleSearchResult: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SimpleSearchResultBase

SimpleSearchResultBase: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SiteSpecific

SiteSpecific: {}

Type declaration

Static Sort

Sort: { field: string; sortOrder?: string } & {}

Static Sorting

Sorting: { sortType: string } & {}

Static SpecifiedPropertiesAllowed

SpecifiedPropertiesAllowed: {} & {}

Static Suggestion

Suggestion: { phrase: string }

Type declaration

  • phrase: string

Static Suggestions

Suggestions: { popularSearchPhrases?: Array<Suggestion>; recentSearchPhrases?: Array<Suggestion>; suggestedSearchPhrases?: Array<Suggestion> }

Type declaration

  • Optional popularSearchPhrases?: Array<Suggestion>
  • Optional recentSearchPhrases?: Array<Suggestion>
  • Optional suggestedSearchPhrases?: Array<Suggestion>

Static SyncCreated

SyncCreated: {}

Type declaration

Static TermFilter

TermFilter: { field: string; operator: string; values?: Array<any> } & {}

Static TermQuery

TermQuery: { fields: Array<string>; operator: string; values?: Array<any> } & {}

Static TextQuery

TextQuery: { fields: Array<string>; searchPhrase: string } & {}

Static Traceable

Traceable: {}

Type declaration

Static ValueFacetInput

ValueFacetInput: { attributeId: string; facetType: string; mask?: Array<string> }

Type declaration

  • attributeId: string
  • facetType: string
  • Optional mask?: Array<string>

Static ValueFacetOutput

ValueFacetOutput: { attributeId: string; facetType: string; values?: Array<ValueFacetOutputEntity> }

Type declaration

Static ValueFacetOutputEntity

ValueFacetOutputEntity: { count: any; value: string } & {}

Static ValueRefinement

ValueRefinement: { attributeId: string; refinementType: string; values: Array<any> }

Type declaration

  • attributeId: string
  • refinementType: string
  • values: Array<any>

Constructors

constructor

  • Parameters

    • config: ClientConfig

    Returns ShopperDiscoverySearch

Properties

clientConfig

clientConfig: ClientConfig

Methods

getSuggestions

  • getSuggestions(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}; retrySettings?: OperationOptions }): Promise<Suggestions>
  • getSuggestions<T>(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : ShopperDiscoverySearch.Suggestions>
  • This method gets suggestions for the user's search activity for a channel.

    If you would like to get a raw Response object use the other getSuggestions function.

    beta

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<Suggestions>

    A promise of type ShopperDiscoverySearch.Suggestions.

  • This method gets suggestions for the user's search activity for a channel.

    beta

    Type parameters

    • T: boolean

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { channelId: string; locale: string; organizationId?: string; searchText?: string; suggestionTypes: Array<string> } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : ShopperDiscoverySearch.Suggestions>

    A promise of type Response if rawResponse is true, a promise of type ShopperDiscoverySearch.Suggestions otherwise.

retrieveResults

  • retrieveResults(options: { body: QueryInput; fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}; retrySettings?: OperationOptions }): Promise<QueryOutput>
  • retrieveResults<T>(options: { body: QueryInput; fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : ShopperDiscoverySearch.QueryOutput>
  • This method retrieves search results for a Channel.

    If you would like to get a raw Response object use the other retrieveResults function.

    beta

    Parameters

    • options: { body: QueryInput; fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: QueryInput
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<QueryOutput>

    A promise of type ShopperDiscoverySearch.QueryOutput.

  • This method retrieves search results for a Channel.

    beta

    Type parameters

    • T: boolean

    Parameters

    • options: { body: QueryInput; fetchOptions?: RequestInit; headers?: {}; parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • body: QueryInput
      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { channelId: string; limit?: number; locale: string; offset?: any; organizationId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : ShopperDiscoverySearch.QueryOutput>

    A promise of type Response if rawResponse is true, a promise of type ShopperDiscoverySearch.QueryOutput otherwise.

Generated using TypeDoc