Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Facets

type FacetType =
    | 'checkbox'
    | 'color'
    | 'date-range'
    | 'link'
    | 'numeric-range'
    | 'range-slider'
    | 'recent-searches'
    | 'related-searches'
    | 'search'
    | 'size'
    | 'tabs'
    | 'unsupported';

interface FacetValueColor {
    name: string;
    hex?: string;
    imageUrl?: string;
}

interface FacetValue {
    title: string;
    imageUrl?: string;
    value?: string;
    color?: FacetValueColor;
    count?: number;
    level?: number;
    selected?: boolean;
    excluded?: boolean;
    children?: Array<FacetValue>;
}

interface FacetRange<T> {
    type: string;
    min?: T;
    max?: T;
    start?: T;
    end?: T;
}

interface DateFacetRange extends FacetRange<Date> {
    type: 'date';
}

interface NumericFacetRange extends FacetRange<number> {
    type: 'numeric';
}

interface Facet {
    id: number;
    type: FacetType;
    title: string;
    values?: Array<FacetValue>;
    field?: string;
    collapsible: boolean;
    collapsed?: boolean;
    range?: DateFacetRange | NumericFacetRange;
    searchable?: boolean;
    searchWithin?: string;
    tooltip?: string;
    truncateThreshold?: number;
    visible: boolean;
}

Pagination

interface PaginationOption {
    title: string;
    pageSize: number;
    selected: boolean;
    default: boolean;
}

interface Pagination {
    page: number;
    pageSize: number;
    totalPages: number;
    totalResults: number;
    maxPageLinks?: number;
    displayFirstLink: boolean;
    displayLastLink: boolean;
    options: Array<PaginationOption>;
}

Redirects

interface Redirect {
    url: string;
    target?: string;
}

Selected Facets

interface SelectedFacetValue {
    title: string;
    value: string;
    excluded: boolean;
}

interface SelectedFacet {
    field: string;
    title: string;
    values: Array<SelectedFacetValue>;
}

Search Results Items

type SearchResultsItemType = 'content' | 'product';

interface SearchResultsItem {
    id: string;
    pinned: boolean;
    visible: boolean;
    score: number;
    type: SearchResultsItemType;
    imageUrl?: string;
    title: string;
    url: string;
    price?: number;
    salePrice?: number;
    attributes?: {
        [key: string]: Array<string>;
    };
}

Sorting

interface SortingOption {
    title: string;
    value: string;
    default: boolean;
    selected: boolean;
}

interface Sorting {
    value?: string;
    options: Array<SortingOption>;
}

Search Response

interface SearchResponse {
    contentZones?: ContentZones;
    facets?: Array<Facet>;
    modifiedQuery?: string;
    pagination?: Pagination;
    query?: string;
    querySuggestions?: Array<string>;
    redirect?: Redirect;
    results?: Array<SearchResultsItem>;
    selectedFacets?: Array<SelectedFacet>;
    sorting?: Sorting;
    success: boolean;
    trackingId: string;
}

For more information on Content Zones, see Content Models.

Search Request

type SelectedFacets = {
    [key: string]: Array<string> | undefined;
};

interface SearchRequest {
    disableSpellcheck?: boolean;
    facets?: SelectedFacets;
    newRequest: boolean;
    pageSize?: number;
    page?: number;
    query?: string;
    searchWithin?: string;
    sort?: string;
}
  • No labels