USASearch

How to Implement Type-ahead Search

Type-ahead search is fast becoming a best practice on websites, and we’ve made this technology available for your site. By default, searchers see type-ahead search suggestions on your search results page.

It is a feature that helps your site’s visitors construct a search query and navigate more quickly to a search results page.

Suggestions display as a list in a drop-down box. This list forms as the searcher begins to type in the search box. The searcher can stop typing and scan the list presented and click on any term in the drop-down list, or the searcher can resume typing if the choices in the list are not helpful. The queries are listed in order of most popular (i.e., most searched) and not in alphabetical order.

Type-ahead suggestions for 'hous' on USA.gov

To implement the Type-ahead Search feature, log in to the Admin Center. After logging in, you have choices to make.

Type-ahead on the Search Results Page

Enable this feature by checking the box labeled Enable Type-ahead search. You can disable it by unchecking the box later if you want.

Populate.

Terms and phrases are automatically populated on a regular basis from searches done in your site’s search box.

On day one of testing USASearch, there will be no terms in Type-ahead Search (unless you add terms to the list, as noted below). The list of terms will build up over time once you implement USASearch on your live website and searchers type their queries in the search box on your site.

Add terms to the list.

You may choose to add terms to the list that displays in type-ahead search. You may:

  1. Upload an individual term (i.e. click on “Add a New Entry”), or
  2. Add a group of terms all at once (i.e., click on “Bulk Upload”).

    To bulk upload:
  • Create a new text file, one entry per line, for example,

    acadia national park
    okefenokee
    okefenokee swamp
    yosemite national park
    yosemite valley
  • Save as a text file—{filename}.txt—on your computer. (Do not save as spreadsheet or word processing files, such as .xls or .doc.)
  • Add, modify, or delete individual entries in the file.
  • Browse for the text file on your computer.
  • Upload the file to the Affiliate Center.

Delete terms from the list.

You may also delete individual terms that you don’t want listed, through “Current Entries”. Use “Filter” to search for particular terms to edit.

Type-ahead on Other Web Pages

You can also add the type-ahead search suggestions to your homepage—or wherever you have a search box on your website—by adding the type-ahead JavaScript code to the head to your HTML web page.

Visit our Admin Center, select your site, and click on the Get Code option in the left-hand menu. For more details, read our post on How to Add Our Code to Your Website.

Filed under type ahead how to