Skip to content

SpacemanPete/autocomplete-search-example

 
 

Repository files navigation

Swiftype Autocomplete and Search Example

This example shows how to combine the Swiftype autocomplete and search jQuery libraries to create a common search experience: autocomplete results plus redirecting to a full search results page.

This example uses a search engine based on the Swiftype website created using our web crawler.

How it works

On the index.html, there is a search box. The autocomplete is configured with the swiftype function (see Swiftype's autocomplete plugin for details). Additionally, there is a jQuery submit event handler that redirects to the search results page with the stq hash parameter set.

On the search results page, the form is repeated, but without the redirect (since the browser is already on that page). The swiftypeSearch function is also configured. This handles displaying the search results in the provided resultContainingElement. See the Swiftype search plugin for more details.

About

Example showing how to use Swiftype's jQuery autocomplete and search plugins together

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 78.8%
  • CSS 13.1%
  • HTML 8.1%