Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Code Block
languagetypescript
interface FacetValueColor {
    name: string;
    hex?: string;
    imageUrl?: string;
}

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

Code Block
languagetypescript
interface 

Facet {     id: number;     type: FacetType;     title: string;     values?: Array<FacetValue>

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';
}

Code Block
languagetypescript
interface Facet {
    id: number;
    

field?

type: 

string

FacetType;
    

collapsible

title: 

boolean

string;
    

collapsed

values?: 

boolean

Array<FacetValue>;
    

rangeMin?

field: 

number

string;
    

rangeMax?

collapsible: 

number

boolean;
    

rangeStart

collapsed?: 

number

boolean;
    

rangeEnd

range?: 

number

DateFacetRange | NumericFacetRange;
    searchable?: boolean;
    searchWithin?: string;
    tooltip?: string;
    truncateThreshold?: number;
    visible: boolean;
}

Pagination

Excerpt
namePagination
Code Block
languagetypescript
interface PaginationOption {
    title: string;
    pageSize: number;
    selected: boolean;
    default: boolean;
}

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

Redirects

Excerpt
nameRedirect
Code Block
languagetypescript
interface Redirect {
    url: string;
    target?: string;
}

...

Excerpt
nameSelectedFacet
Code Block
languagetypescript
export interface SelectedFacetValue {
    title: string;
    value: string;
    excluded: boolean;
}

Code Block
languagetypescript

export

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

Search Results Items

Excerpt
nameSearchResultsItem
Code Block
languagetypescript
type SearchResultsItemType = 'content' | 'product';

Code Block
languagetypescript
interface SearchResultsItem {
    

id

attributes?: 

string;

{
        

pinned

[key: string]: 

boolean

Array<string>;
    

visible: boolean

};
    

score

description?: 

number

string;
    

type

id: 

SearchResultsItemType

string;
    imageUrl?: string;
    

title

pinned: 

string

boolean;
    

url

price?: 

string

number;
    

price

salePrice?: number;
    

salePrice?

score: number;
    

attributes?

title: string;

{

    type: SearchResultsItemType;
   

[key

 url: string

]: Array<string>

;
    

}

visible: boolean;
}

Sorting

Excerpt
nameSorting
Code Block
languagetypescript
interface SortingOption {
    title: string;
    value: string;
    default: boolean;
    selected: boolean;
}

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

Search Response

Excerpt
nameSearchResponse
Code Block
languagetypescript
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;
}

...

Excerpt
nameSearchRequest
Code Block
languagetypescript
type SelectedFacets = {
    [key: string]: Array<string> | undefined;
};

Code Block
languagetypescript
interface SearchRequest {
    disableSpellcheck?: boolean;
    facets?: SelectedFacets;
    newRequest: boolean;
    pageSize?: number;
    page?: number;
    query?: string;
    searchWithin?: string;
    sort?: string;
}