Legacy Search Widget Behavior Options
Before August 2014, installing the Swiftype search embed required customizing every option manually. The Swiftype Search Widget Designer allows you to change all of the settings below through the Swiftype Dashboard without updating any code on your site. If you are using the original install code, you can continue to customize search behavior using the options below. To switch to the Search Widget Designer, please follow our upgrade tutorial.
Swiftype.key
Your Engine Key. This should be set for you in the code you get from the Install tab.
Swiftype.renderStyle
The style of search results to use. If not set, the search results will default to the overlay style.\n Acceptable values are one of "overlay", "inline", "new_page", or `false.
Setting renderStyle to false will disable search results. Do this if you only want to use the Swiftype Search Widget for autocomplete.
The inline and new_page styles require a result container to be added to the DOM where you would like to display search results. By default, this element has the id st-results-container (see resultContainingElement).
The new_page style requires resultPageURL the be set as well.
Swiftype.resultPageURL
The URL for the search results page. Required for the new_page style. When the search form is submitted, the user will be redirected to this URL. The DOM of the results page must have a result container to put the results in. By Default, this element has the id st-results-container (see resultContainingElement).
Swiftype.resultContainingElement
The CSS selector string to locate the container for inserting the search results.
Used for inline and new_page (on the results page) styles. Defaults to #st-results-container if not specified.
Swiftype.disableAutocomplete
Set disableAutocomplete to true to disable the autocomplete drop down. Set this option to use the Swiftype Search Widget for full-text search only.
Swiftype.inputElement
A CSS selector for the search input. Defaults to #st-search-input if not specified.
Swiftype.attachElement
The CSS selector for the element to attach the autocomplete dropdown to. Defaults to #st-search-input if not specified.
Swiftype.autocompleteResultLimit
Set autocompleteResultLimit to change the maximum number of results returned in the autocomplete drop down.
This option does not apply to a specific DocumentType.
Swiftype.autocompleteResultLimit = 3;
Swiftype.searchPerPage
Change the number of search results returned per page.
Swiftype.searchPerPage = 5;
Stuck? Looking for help? Contact support or check out the Site Search community forum!