Interfaces
Below are the Interfaces used by the SearchStax Site Search solution’s various JS Widgets. As you use the JS library to write your custom search page, these provide you the details of the attributes used by each Interface.
- Search Input Interfaces
- Search Interfaces
- Search Results Interfaces
- Facets Interfaces
- Pagination Interfaces
- Search Feedback Interfaces
- Related Searches Interfaces
- Promotions Interfaces
- Sorting Interfaces
Search Input Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | export interface ISearchstaxSearchInputConfig { suggestAfterMinChars: number; // controls how many characters the UI should accept at the minimum before showing suggestions templates?: ISearchstaxSearchInputConfigTemplates; // optional object that defines template override options hooks?: { // optional object that provides various hook options beforeAutosuggest?: (props: ISearchstaxSuggestProps) => ISearchstaxSuggestProps | null ; // this function gets called before firing autosuggest. autosuggestProps are being passed as a property and can be modified, if passed along further search will execute with modified properties, if null is returned then event gets canceled and search never fires. afterAutosuggest?: (result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse; // this function gets called after autosuggest has values but before rendering. It needs to return same type of data but it can be modified. }; } export interface ISearchstaxSearchProps { term: string; queryParams: string[]; } export interface ISearchstaxSuggestProps { term: string; queryParams: IAdditionalProp[]; } export interface ISearchstaxSearchInputConfigTemplates { mainTemplate?: ISearchstaxSearchInputMainTemplateData; // optional object for overriding main template autosuggestItemTemplate?: ISearchstaxSearchInputAutosuggestTemplateData; // autosuggest item template in Mustache } export interface ISearchstaxSearchInputMainTemplateData{ template: string; // main template in Mustache templating language searchInputId: string; // id of search input within the mainTemplate } export interface ISearchstaxSearchInputAutosuggestTemplateData{ template: string; // autosuggest template in Mustache templating language } |
Search Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | export interface ISearchstaxSuggestResponseHeader { zkConnected: boolean; status: number; qTime: number; } export interface ISearchstaxSuggestion { term: string; weight: number; payload: string; } export interface ISearchstaxSEARCHTERM { numFound: number; suggestions: ISearchstaxSuggestion[]; } export interface ISearchstaxStudio_suggestor_LANG { [key: string]: ISearchstaxSEARCHTERM; } export interface ISearchstaxSuggest { [key: string]: ISearchstaxStudio_suggestor_LANG; } export interface ISearchstaxSuggestResponse { responseHeader: ISearchstaxSuggestResponseHeader; suggest: ISearchstaxSuggest; } |
Search Results Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | export interface ISearchstaxParam { q: string; language: string; echoParams: string; wt: string; rows: string; hl: string; "hl.snippets" : string; facet: string; fl: string; "facet.field" : string[]; "f.content_type_facet.facet.limit" : string; "f.content_type_facet.facet.mincount" : string; "f.content_type_facet.facet.sort" : string; "f.author_name.facet.limit" : string; "f.author_name.facet.mincount" : string; "f.author_name.facet.sort" : string; "f.meta_keywords_facet.facet.limit" : string; "f.meta_keywords_facet.facet.mincount" : string; "f.meta_keywords_facet.facet.sort" : string; defType: string; qf: string; uniqueId: string; "spellcheck.q" : string; "spellcheck.accuracy" : string; "spellcheck.extendedResults" : string; spellcheck: string; "spellcheck.dictionary" : string; "spellcheck.count" : string; bq: string; bf: string; rid: string; autoCorrectedQ?: string; } export interface ISearchstaxResponseHeader { zkConnected: boolean; status: number; QTime: number; params: ISearchstaxParam; } export interface ISearchstaxDocCommon { [key: string]: string | string[] | boolean; } export interface ISearchstaxDoc extends ISearchstaxDocCommon { "[elevated]" : boolean; } export interface ISearchstaxParsedResult { custom?: any; ribbon: string | null ; paths: string | null ; url: string | null ; title: string | null ; promoted: boolean | null ; thumbnail: string | null ; date: string | null ; snippet: string | null ; description: string | null ; uniqueId: string; position: number; unmappedFields: { key: string; value: string | string[] | boolean; isImage?: boolean }[]; allFields: { key: string; value: string | string[] | boolean }[]; } export interface ISearchstaxSearchMetadata { recordsPerPageValue: number; startDocVal: number; totalResultsValue: number; latency: number; endDocValue: number; spellingSuggestion: string; autoCorrectedQuery: string; impressions: ISearchstaxImpression[]; } export interface ISearchstaxImpression { cDocId: string; cDocTitle: string; position: number; } export interface ISearchstaxRelatedImpression { relatedSearch: string; position: number; } export interface ISearchstaxResponse { numFound: number; start: number; numFoundExact: boolean; docs: ISearchstaxDoc[]; } export interface ISearchstaxFacet_query {} export interface ISearchstaxFacet_field { content_type_facet: any[]; author_name: any[]; meta_keywords_facet: any[]; } export interface ISearchstaxFacet_range {} export interface ISearchstaxFacet_interval {} export interface ISearchstaxFacet_heatmap {} export interface ISearchstaxFacet_count { facet_queries: ISearchstaxFacet_query; facet_fields: ISearchstaxFacet_field; facet_ranges: ISearchstaxFacet_range; facet_intervals: ISearchstaxFacet_interval; facet_heatmaps: ISearchstaxFacet_heatmap; } export interface Spellcheck { suggestions: any[]; correctlySpelled: boolean; } export interface ISearchstaxFacet { name: string; label: string; } export interface ISearchstaxResult { name: string; title: string; result_card: string; } export interface ISearchstaxSort { id: number; name: string; order: string; label: string; } export interface IExternalPromotion { name: string; id: number; url: string; description: string; } export interface ISearchstaxMetadata { facets: ISearchstaxFacet[]; results: ISearchstaxResult[]; sorts: ISearchstaxSort[]; } export interface ISearchstaxSearchResponse { responseHeader: ISearchstaxResponseHeader; response: ISearchstaxResponse; facet_counts: ISearchstaxFacet_count; spellcheck: Spellcheck; metadata: ISearchstaxMetadata; externalLinks?: IExternalPromotion[]; } export interface ISearchstaxParsedData { currentPage: number; totalResults: number; resultsPerPage: number; isFirstPage: boolean; results: ISearchstaxParsedResult[]; isLastPage: boolean; hasResults: boolean; hasResultsOrExternalPromotions: boolean; searchExecuted: boolean; hasRelatedSearches: boolean; hasExternalPromotions: boolean; startResultIndex: number; endResultIndex: number; searchTerm: string; autoCorrectedQuery: string; originalQuery: string; selectedFacets: (IFacetValue | IFacetValueRange)[]; relatedSearches: ISearchstaxRelatedSearchResult[]; externalPromotions: IExternalPromotion[]; } export interface ISearchstaxSearchResultsConfig { templates?: ISearchstaxSearchResultsConfigTemplates; // optional object that defines template override options hooks?: { // optional object that provides various hook options afterLinkClick?: ( resultClicked: ISearchstaxParsedResult ) => ISearchstaxParsedResult | null ; // function is called after user clicks result and passes that result as a property. when result is passed along tracking will execute and user will be navigated if null is returned events are canceled and nothing happens. }; } export interface ISearchstaxSearchResultsConfigTemplates { mainTemplate?: ISearchstaxResultsMainTemplateData; searchResultTemplate?: ISearchstaxResultsResultTemplateData; noSearchResultTemplate?: ISearchstaxResultsNoResultTemplateData; } export interface ISearchstaxResultsMainTemplateData { template: string; // main template in Mustache templating language searchResultsContainerId: string; // this is needed only if mainTemplate is overridden. It points to an element in the template where results need to be rendered } export interface ISearchstaxResultsResultTemplateData { template: string; // result template using Mustache. ISearchstaxParsedResult is passed to the template and all its properties are available to be used when rendering; searchResultUniqueIdAttribute: string; // this is needed only if searchResultTemplate is overridden. searchResultTemplate needs to have unique result id property. Default is data-searchstax-unique-result-id="niqueId". see example below on how it is used } export interface ISearchstaxResultsNoResultTemplateData { template: string; // Mustache template for no results section override. spellingSuggestion and searchTerm are values available in the template } export interface ISearchstaxParsedResult { custom?: any; ribbon: string | null ; paths: string | null ; url: string | null ; title: string | null ; promoted: boolean | null ; thumbnail: string | null ; date: string | null ; snippet: string | null ; description: string | null ; uniqueId: string; position: number; unmappedFields: { key: string; value: string | string[] | boolean; isImage?: boolean }[]; allFields: { key: string; value: string | string[] | boolean }[]; } |
Facets Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | export interface IFacet { name: string; label: string; values: (IFacetValue | IFacetValueRange)[]; } export interface IFacetValue { value: string; type: 'checkbox' ; parentName: string; count: number; } export interface IFacetValueRange { valueFrom: string; type: 'range' ; valueTo: string; parentName: string; count: number; } export interface IFacetData extends IFacet{ values: (IFacetValue | IFacetValueRange)[]; showingAllFacets?: boolean; hasMoreFacets?: boolean; } export interface IFacetsTemplateData extends ISearchstaxParsedData{ facets: IFacetData[]; isMobile?: boolean; } export interface IFacetValueData extends IFacetValue { disabled?: boolean; } export interface ISearchstaxSearchFacetsConfig { facetingType: "and" | "or" | "showUnavailable" | "tabs" ; // type that determines how facets will behave specificFacets?: string[]; // optional array of facet names that if provided will only render those facets itemsPerPageDesktop: number; // default expanded facets for desktop itemsPerPageMobile: number; // default expanded facets for mobile templates?: ISearchstaxSearchFacetsClearFacetsTemplates; // optional object that defines template override options } export interface ISearchstaxSearchFacetsClearFacetsTemplates { mainTemplateDesktop?: ISearchstaxSearchFacetsMainTemplateData; // optional object for overriding main template mainTemplateMobile?: ISearchstaxSearchFacetsMainMobileTemplate; // optional object for overriding main mobile template showMoreButtonContainerTemplate?: ISearchstaxSearchFacetsShowMoreTemplateData; // optional object for overriding facet section show more/less template facetItemContainerTemplate?: ISearchstaxSearchFacetsItemContainerTemplateData; // optional object for overriding facet container template clearFacetsTemplate?: ISearchstaxSearchFacetsselectedFacetsTemplateData; // optional object for overriding clear facets container template facetItemTemplate?: ISearchstaxSearchFacetsItemTemplateData; // optional object for overriding clear facet item template filterByTemplate?: ISearchstaxSearchFacetsFilterByTemplateData; // optional object for overriding filter by button template selectedFacetsTemplate?: ISearchstaxSearchFacetsselectedFacetsTemplateData; // optional object for overriding selected facets template } export interface ISearchstaxSearchFacetsClearFacetsTemplateData { template: string; containerClass: string; } export interface ISearchstaxSearchFacetsselectedFacetsTemplateData { template: string; //main template in Mustache templating language. data available: IFacetValue | IFacetValueRange containerClass: string; //class where selected facets will be placed within the template } export interface ISearchstaxSearchFacetsFilterByTemplateData { template: string; //main template in Mustache templating language containerClass: string; // class where button will be placed within the template } export interface ISearchstaxSearchFacetsItemTemplateData { template: string; // main template in Mustache templating language. data available: { ...IFacetValueData, isChecked } inputCheckboxClass?: string; // class of checkboxes checkTriggerClasses?: string[]; // class list of elements that trigger facet select/unselect action } export interface ISearchstaxSearchFacetsItemContainerTemplateData { template: string; // main template in Mustache templating language. data available: IFacetData facetListTitleContainerClass: string; // container class where facet category title will be rendered within template facetListContainerClass: string; // container class where facet items will be listed } export interface ISearchstaxSearchFacetsShowMoreTemplateData { template: string; // main template in Mustache templating language. data available: IFacetData showMoreButtonClass: string; // class of container where show more/less button will be placed } export interface ISearchstaxSearchFacetsMainTemplateData { template: string; // main template in Mustache templating language data available: IFacetsTemplateData facetsContainerClass: string; // class of container where facets will be placed selectedFacetsContainerClass?: string; // class of container where selected facets will be placed } export interface ISearchstaxSearchFacetsMainMobileTemplate { template: string; // main template in Mustache templating language. data available: IFacetsTemplateData facetsContainerClass: string; // class of container where facets will be placed closeOverlayTriggerClasses?: string[]; // class list of all elements that should trigger mobile overlay close action filterByContainerClass?: string; // class of container where "Filter By" button will be rendered selectedFacetsContainerClass?: string; // class of container where selected facets will be listed } |
Pagination Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | export interface IPaginationData extends ISearchstaxParsedData { nextPageLink: string; previousPageLink: string; } export interface ISearchstaxSearchPaginationConfig { templates?: ISearchstaxSearchPaginationConfigTemplates; // optional object that defines template override options } export interface ISearchstaxSearchPaginationConfigTemplates { mainTemplate?: ISearchstaxSearchPaginationTemplateData; // optional object for overriding main template } export interface ISearchstaxSearchPaginationTemplateData { template: string; // main template in Mustache templating language. Data available: IPaginationData previousButtonClass: string; // class of previous page link within template nextButtonClass: string; // class of next page link within template } |
Search Feedback Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 | export interface ISearchstaxSearchFeedbackConfig { templates?: ISearchstaxSearchFeedbackConfigTemplates; // optional object that defines template override options } export interface ISearchstaxSearchFeedbackConfigTemplates { main?: ISearchstaxSearchFeedbackTemplateData; // optional object for overriding main template } export interface ISearchstaxSearchFeedbackTemplateData { template: string; // main template in Mustache templating language, originalQueryClass: string; // class of element that contains original query and will execute search on click. Search term is innerHTML of that element } |
Related Searches Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | export interface ISearchstaxParam { q: string; fl: string; _forwardedCount: string; _: string; } export interface ISearchstaxRelatedSearchesResponseHeader { zkConnected: boolean; status: number; qTime: number; params: ISearchstaxParam; } export interface ISearchstaxRelatedSearchResult { search_term: string; related_search: string; score: number; last?: boolean; position?: number; } export interface ISearchstaxRelatedSearchesResponseBody { numFound: number; start: number; maxScore: number; numFoundExact: boolean; docs: ISearchstaxRelatedSearchResult[]; } export interface ISearchstaxRelatedSearchesResponse { responseHeader: ISearchstaxRelatedSearchesResponseHeader; response: ISearchstaxRelatedSearchesResponseBody; } export interface ISearchstaxRelatedSearchesConfig { relatedSearchesURL: string; // URL of related searches endpoint relatedSearchesAPIKey: string; // related searches api key templates?: ISearchstaxRelatedSearchesConfigTemplates; // optional object that defines template override options } export interface ISearchstaxRelatedSearchesConfigTemplates { main?: ISearchstaxRelatedSearchesTemplateData; // optional object for overriding main template relatedSearch?: ISearchstaxRelatedSearchTemplateData; // optional object for overriding related search template } export interface ISearchstaxRelatedSearchesTemplateData { template: string; // main template in Mustache templating language relatedSearchesContainerClass: string; // class where related searches will be rendered within the template } export interface ISearchstaxRelatedSearchTemplateData { template: string; // main template in Mustache templating language relatedSearchContainerClass: string; // class where related search item will be rendered within the template } |
Promotions Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | export interface IExternalPromotion { name: string; id: number; url: string; description: string; } export interface ISearchstaxExternalPromotionsConfig { templates?: ISearchstaxExternalPromotionsTemplates // optional object that defines template override options } export interface ISearchstaxExternalPromotionsTemplates{ mainTemplate?: ISearchstaxExternalPromotionsTemplateData; // optional object for overriding main template externalPromotion?: ISearchstaxExternalPromotionTemplateData; // optional object for overriding main template } export interface ISearchstaxExternalPromotionsTemplateData { template: string; // main template in Mustache templating language externalPromotionsContainerId: string; // id where external promotions will be rendered within the template } export interface ISearchstaxExternalPromotionTemplateData { template: string; // main template in Mustache templating language } |
Sorting Interfaces
1 2 3 | export interface ISearchstaxSearchSortingData extends ISearchstaxParsedData{ } |
Questions?
Do not hesitate to contact the SearchStax Support Desk.