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 8 Next »

Facets

type FacetType = 'checkbox' | 'color' | 'link' | 'range-slider' | 'recent-searches' | 'related-searches' | 'search' | 'size' | 'tabs'
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 Facet {
    id: number;
    type: FacetType;
    title: string;
    values?: Array<FacetValue>;
    field?: string;
    collapsible: boolean;
    collapsed?: boolean;
    rangeMin?: number;
    rangeMax?: number;
    rangeStart?: number;
    rangeEnd?: number;
    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

export interface SelectedFacetValue {
    title: string;
    value: string;
    excluded: boolean;
}
export 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 {
    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;
}

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