AutoComplete

dbuthay edited this page Sep 19, 2011 · 5 revisions

Requirements

  • an Indextank_[Ize]'d FORM that contains an INPUT.
  • import jquery.indextank.autocomplete.js

How it works

Autocomplete is quite simple. It will show QUERY suggestions on an INPUT. When you press enter, or select a suggestions by clicking on it, 2 things will happen:

  • the INPUT will have the selected value
  • the FORM will be submitted

AjaxSearch (and InstantSearch) provide a way to submit the FORM via JSONP, so you can have the results rendered on a static page.

Usage

A basic example:

$("#query").indextank_Autocomplete();

A more complex example:

$("#query").indextank_Autocomplete( {fieldName: "name"});

Options

  • fieldName: the name of the field to use when generating the suggestion. It does not mean that when pressing enter the query will run against that field. See AjaxSearch rewriteQuery to change that.

Events

  • Triggers (to self)
    • Indextank.Autocomplete.success: when the autocomplete succeeds. Passes suggestions as first parameter.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.